結果

問題 No.29 パワーアップ
ユーザー shinshin
提出日時 2022-05-15 18:27:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 5,000 ms
コード長 551 bytes
コンパイル時間 3,652 ms
コンパイル使用メモリ 72,724 KB
実行使用メモリ 56,192 KB
最終ジャッジ日時 2023-10-11 04:25:59
合計ジャッジ時間 7,771 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,900 KB
testcase_01 AC 124 ms
55,816 KB
testcase_02 AC 123 ms
55,704 KB
testcase_03 AC 124 ms
55,864 KB
testcase_04 AC 123 ms
55,852 KB
testcase_05 AC 127 ms
55,700 KB
testcase_06 AC 125 ms
56,100 KB
testcase_07 AC 123 ms
55,840 KB
testcase_08 AC 122 ms
56,192 KB
testcase_09 AC 122 ms
55,764 KB
testcase_10 AC 128 ms
56,080 KB
testcase_11 AC 132 ms
55,920 KB
testcase_12 AC 123 ms
55,468 KB
testcase_13 AC 127 ms
56,040 KB
testcase_14 AC 129 ms
55,800 KB
testcase_15 AC 130 ms
55,852 KB
testcase_16 AC 129 ms
55,860 KB
testcase_17 AC 124 ms
55,676 KB
testcase_18 AC 125 ms
55,948 KB
testcase_19 AC 124 ms
55,808 KB
testcase_20 AC 122 ms
56,180 KB
testcase_21 AC 123 ms
55,600 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