結果
問題 |
No.29 パワーアップ
|
ユーザー |
![]() |
提出日時 | 2018-02-09 15:12:02 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 610 bytes |
コンパイル時間 | 1,888 ms |
コンパイル使用メモリ | 74,192 KB |
実行使用メモリ | 41,636 KB |
最終ジャッジ日時 | 2024-10-07 00:45:36 |
合計ジャッジ時間 | 5,514 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 WA * 17 |
ソースコード
import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int[] ar = new int[11]; int times = 0; int n = sc.nextInt(); for (int i=0; i<n; i++) { int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); ar[a]++; ar[b]++; ar[c]++; if (ar[a]==2) { times++; ar[a] = 0; } if (ar[b]==2) { times++; ar[b] = 0; } if (ar[c]==2) { times++; ar[c] = 0; } } int sum = 0; for (int i=0; i<ar.length; i++) { sum += ar[i]; } System.out.println(times+(sum/4)); } }