結果

問題 No.29 パワーアップ
ユーザー shin
提出日時 2022-05-15 18:27:40
言語 Java
(openjdk 23)
結果
AC  
実行時間 135 ms / 5,000 ms
コード長 551 bytes
コンパイル時間 4,199 ms
コンパイル使用メモリ 75,664 KB
実行使用メモリ 54,388 KB
最終ジャッジ日時 2024-09-13 03:46:58
合計ジャッジ時間 7,418 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

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