結果

問題 No.29 パワーアップ
ユーザー kou6839kou6839
提出日時 2014-11-18 16:31:22
言語 Java21
(openjdk 21)
結果
AC  
実行時間 138 ms / 5,000 ms
コード長 605 bytes
コンパイル時間 1,866 ms
コンパイル使用メモリ 71,680 KB
実行使用メモリ 56,484 KB
最終ジャッジ日時 2023-08-30 20:33:59
合計ジャッジ時間 6,100 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
56,068 KB
testcase_01 AC 118 ms
53,544 KB
testcase_02 AC 118 ms
55,708 KB
testcase_03 AC 122 ms
54,512 KB
testcase_04 AC 119 ms
55,404 KB
testcase_05 AC 135 ms
55,640 KB
testcase_06 AC 134 ms
55,576 KB
testcase_07 AC 126 ms
55,708 KB
testcase_08 AC 122 ms
56,248 KB
testcase_09 AC 120 ms
55,724 KB
testcase_10 AC 137 ms
55,764 KB
testcase_11 AC 138 ms
55,608 KB
testcase_12 AC 122 ms
55,472 KB
testcase_13 AC 135 ms
55,700 KB
testcase_14 AC 135 ms
56,484 KB
testcase_15 AC 136 ms
56,372 KB
testcase_16 AC 134 ms
55,600 KB
testcase_17 AC 123 ms
55,368 KB
testcase_18 AC 127 ms
55,760 KB
testcase_19 AC 129 ms
55,644 KB
testcase_20 AC 119 ms
55,944 KB
testcase_21 AC 121 ms
55,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
 

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] num = new int[11];
		int ans=0;
		for(int i=0;i<n;i++){
			for(int j=0;j<3;j++){
				int aa = sc.nextInt();
				if(num[aa]==1){
					ans++;
					num[aa]=0;
				}else{
					num[aa]++;
				}		
			}
		}
		int temp=0;
		for(int i=1;i<=10;i++){
			if(num[i]==1) temp++;
		}
		if(temp<4){
			System.out.println(ans);
		}else if(temp<8){
			System.out.println(ans+1);
		}else{
			System.out.println(ans+2);
			
		}
	}
}	
0