結果

問題 No.29 パワーアップ
ユーザー shinshin
提出日時 2022-05-15 18:27:40
言語 Java17
(openjdk 17.0.1)
結果
AC  
実行時間 97 ms / 5,000 ms
コード長 551 bytes
コンパイル時間 3,280 ms
使用メモリ 37,672 KB
最終ジャッジ日時 2023-02-24 19:36:51
合計ジャッジ時間 6,637 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 88 ms
37,444 KB
testcase_01 AC 86 ms
37,396 KB
testcase_02 AC 86 ms
37,436 KB
testcase_03 AC 88 ms
37,420 KB
testcase_04 AC 84 ms
37,464 KB
testcase_05 AC 88 ms
37,496 KB
testcase_06 AC 94 ms
37,576 KB
testcase_07 AC 91 ms
37,292 KB
testcase_08 AC 91 ms
37,672 KB
testcase_09 AC 87 ms
37,392 KB
testcase_10 AC 96 ms
37,608 KB
testcase_11 AC 97 ms
37,436 KB
testcase_12 AC 93 ms
37,472 KB
testcase_13 AC 90 ms
37,456 KB
testcase_14 AC 93 ms
37,576 KB
testcase_15 AC 93 ms
37,564 KB
testcase_16 AC 92 ms
37,488 KB
testcase_17 AC 87 ms
37,464 KB
testcase_18 AC 89 ms
37,416 KB
testcase_19 AC 89 ms
37,540 KB
testcase_20 AC 89 ms
37,336 KB
testcase_21 AC 90 ms
37,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Scanner;
public class No29 {

	public static void main(String[] args) {
		//パワーアップ
		Scanner s = new Scanner(System.in);
		int N = Integer.parseInt(s.nextLine()), count = 0,i;
		ArrayList<String> list = new ArrayList<>();
		for(i = 0;i < N;i++) {
			for(String str : s.nextLine().split(" ")) {
				if(list.contains(str)) {
					count++;
					list.remove(str);
				}else {
					list.add(str);
				}
			}
		}

		s.close();
		
		count += (int)(list.size() / 4);
		System.out.println(count);
	}

}
0