結果
問題 | No.29 パワーアップ |
ユーザー | ohagi_1182 |
提出日時 | 2017-10-21 14:30:24 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 517 bytes |
コンパイル時間 | 2,299 ms |
コンパイル使用メモリ | 74,176 KB |
実行使用メモリ | 41,816 KB |
最終ジャッジ日時 | 2024-05-01 09:13:42 |
合計ジャッジ時間 | 6,444 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 136 ms
41,420 KB |
testcase_01 | AC | 133 ms
41,532 KB |
testcase_02 | AC | 132 ms
41,440 KB |
testcase_03 | WA | - |
testcase_04 | AC | 134 ms
41,400 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 140 ms
41,420 KB |
testcase_08 | WA | - |
testcase_09 | AC | 133 ms
41,468 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 145 ms
41,536 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 126 ms
41,816 KB |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] x = new int[11]; for(int i = 0 ; i < n ; i++) { int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); x[a]++; x[b]++; x[c]++; } int ans = 0; int cnt = 0; for(int i = 0 ; i < 11 ; i++) { if(x[i] >= 2) { ans += x[i] / 2; } else if(x[i] == 1) { cnt++; } } ans += cnt / 4; System.out.println(ans); } }