結果
問題 | No.29 パワーアップ |
ユーザー |
![]() |
提出日時 | 2014-11-18 16:31:22 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 137 ms / 5,000 ms |
コード長 | 605 bytes |
コンパイル時間 | 2,080 ms |
コンパイル使用メモリ | 76,168 KB |
実行使用メモリ | 54,472 KB |
最終ジャッジ日時 | 2025-01-02 17:02:56 |
合計ジャッジ時間 | 5,871 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
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); } } }