結果

問題 No.29 パワーアップ
ユーザー omc-testomc-test
提出日時 2016-08-22 10:19:00
言語 Java17
(openjdk 17.0.1)
結果
AC  
実行時間 117 ms / 5,000 ms
コード長 478 bytes
コンパイル時間 2,864 ms
使用メモリ 51,076 KB
最終ジャッジ日時 2022-12-14 05:44:58
合計ジャッジ時間 6,682 ms
ジャッジサーバーID
(参考情報)
judge16 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 98 ms
50,900 KB
testcase_01 AC 101 ms
50,800 KB
testcase_02 AC 103 ms
51,004 KB
testcase_03 AC 99 ms
50,836 KB
testcase_04 AC 103 ms
51,076 KB
testcase_05 AC 115 ms
50,880 KB
testcase_06 AC 110 ms
50,876 KB
testcase_07 AC 108 ms
50,780 KB
testcase_08 AC 109 ms
48,696 KB
testcase_09 AC 106 ms
50,916 KB
testcase_10 AC 116 ms
50,916 KB
testcase_11 AC 116 ms
50,744 KB
testcase_12 AC 107 ms
50,764 KB
testcase_13 AC 110 ms
50,920 KB
testcase_14 AC 117 ms
50,840 KB
testcase_15 AC 112 ms
51,008 KB
testcase_16 AC 114 ms
51,000 KB
testcase_17 AC 105 ms
50,676 KB
testcase_18 AC 108 ms
50,880 KB
testcase_19 AC 113 ms
50,964 KB
testcase_20 AC 100 ms
50,996 KB
testcase_21 AC 104 ms
50,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No0029 {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] num = new char[10];
		for(int i=0; i<n; i++){
			for(int j=0; j<3; j++){
				int data = sc.nextInt();
				num[data-1] ++;
			}
		}
		sc.close();
		int cnt1 = 0;
		int cnt2 = 0;
		for(int i=0; i<10; i++){
			cnt1 += num[i] / 2;
			cnt2 += num[i] % 2;
		}
		int ans = cnt1 + (cnt2 / 4);
		System.out.println(ans);
	}
}
0