結果

問題 No.29 パワーアップ
ユーザー SuunnSuunn
提出日時 2018-11-20 05:16:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 145 ms / 5,000 ms
コード長 428 bytes
コンパイル時間 1,938 ms
コンパイル使用メモリ 71,980 KB
実行使用メモリ 56,432 KB
最終ジャッジ日時 2023-08-26 02:10:41
合計ジャッジ時間 5,734 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
53,796 KB
testcase_01 AC 119 ms
56,432 KB
testcase_02 AC 119 ms
55,924 KB
testcase_03 AC 123 ms
56,028 KB
testcase_04 AC 121 ms
56,064 KB
testcase_05 AC 136 ms
56,108 KB
testcase_06 AC 135 ms
55,872 KB
testcase_07 AC 128 ms
55,692 KB
testcase_08 AC 125 ms
56,072 KB
testcase_09 AC 120 ms
54,156 KB
testcase_10 AC 138 ms
55,848 KB
testcase_11 AC 145 ms
55,724 KB
testcase_12 AC 122 ms
55,760 KB
testcase_13 AC 135 ms
56,028 KB
testcase_14 AC 137 ms
56,376 KB
testcase_15 AC 131 ms
55,508 KB
testcase_16 AC 135 ms
55,996 KB
testcase_17 AC 125 ms
55,696 KB
testcase_18 AC 129 ms
56,028 KB
testcase_19 AC 129 ms
56,100 KB
testcase_20 AC 120 ms
56,016 KB
testcase_21 AC 120 ms
56,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
	

public class Main{
	
	
	public static void main(String args[])throws Exception{
		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] item = new int[11];
		for(int i=0;i<3*N;i++){
			int I = sc.nextInt();
			item[I]++;
		}
		int ans = 0;
		int amari = 0;
		for(int i=1;i<=10;i++){
			ans += item[i]/2;
			amari += item[i]%2;
		}
		ans += amari/4;
		System.out.println(ans);
	}
}
0