結果

問題 No.29 パワーアップ
ユーザー omc-testomc-test
提出日時 2016-08-22 10:19:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 478 bytes
コンパイル時間 3,316 ms
コンパイル使用メモリ 74,516 KB
実行使用メモリ 41,780 KB
最終ジャッジ日時 2024-04-25 11:15:19
合計ジャッジ時間 6,292 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
40,112 KB
testcase_01 AC 111 ms
41,240 KB
testcase_02 AC 108 ms
40,184 KB
testcase_03 AC 103 ms
40,156 KB
testcase_04 AC 110 ms
41,168 KB
testcase_05 AC 134 ms
41,540 KB
testcase_06 AC 120 ms
41,444 KB
testcase_07 AC 115 ms
41,368 KB
testcase_08 AC 114 ms
40,000 KB
testcase_09 AC 104 ms
40,848 KB
testcase_10 AC 122 ms
41,364 KB
testcase_11 AC 124 ms
41,524 KB
testcase_12 AC 112 ms
41,120 KB
testcase_13 AC 112 ms
40,828 KB
testcase_14 AC 127 ms
41,780 KB
testcase_15 AC 120 ms
41,664 KB
testcase_16 AC 120 ms
41,492 KB
testcase_17 AC 112 ms
40,356 KB
testcase_18 AC 115 ms
40,856 KB
testcase_19 AC 120 ms
41,260 KB
testcase_20 AC 110 ms
41,024 KB
testcase_21 AC 107 ms
41,116 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