結果

問題 No.29 パワーアップ
ユーザー shinshin
提出日時 2022-05-15 18:37:42
言語 Java21
(openjdk 21)
結果
AC  
実行時間 49 ms / 5,000 ms
コード長 707 bytes
コンパイル時間 3,497 ms
コンパイル使用メモリ 72,856 KB
実行使用メモリ 49,720 KB
最終ジャッジ日時 2023-10-11 04:38:09
合計ジャッジ時間 5,527 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,288 KB
testcase_01 AC 44 ms
49,316 KB
testcase_02 AC 45 ms
49,232 KB
testcase_03 AC 44 ms
49,316 KB
testcase_04 AC 42 ms
49,256 KB
testcase_05 AC 46 ms
49,420 KB
testcase_06 AC 46 ms
49,456 KB
testcase_07 AC 44 ms
49,216 KB
testcase_08 AC 44 ms
49,212 KB
testcase_09 AC 43 ms
49,248 KB
testcase_10 AC 46 ms
49,324 KB
testcase_11 AC 46 ms
49,304 KB
testcase_12 AC 44 ms
47,512 KB
testcase_13 AC 46 ms
49,204 KB
testcase_14 AC 49 ms
49,720 KB
testcase_15 AC 47 ms
49,704 KB
testcase_16 AC 44 ms
49,252 KB
testcase_17 AC 44 ms
49,172 KB
testcase_18 AC 44 ms
49,184 KB
testcase_19 AC 44 ms
49,328 KB
testcase_20 AC 45 ms
49,444 KB
testcase_21 AC 44 ms
49,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class No29_2{

	public static void main(String[] args)  throws IOException{
		//パワーアップ 作り直し
		ArrayList<String> list = new ArrayList<>();
		int count = 0 , i;
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int N = Integer.parseInt(br.readLine());
		for(i = 0;i < N;i++) {
			for(String str : br.readLine().split(" ")) {
				if(list.contains(str)) {
					count++;
					list.remove(str);
				}else {
					list.add(str);
				}
			}
		}

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

}
0