結果
問題 | No.29 パワーアップ |
ユーザー |
![]() |
提出日時 | 2016-10-21 11:39:34 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 150 ms / 5,000 ms |
コード長 | 841 bytes |
コンパイル時間 | 2,037 ms |
コンパイル使用メモリ | 73,652 KB |
実行使用メモリ | 41,468 KB |
最終ジャッジ日時 | 2024-11-23 16:05:02 |
合計ジャッジ時間 | 5,853 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int ItemsTotal[] = new int[10]; for (int i = 0; i < n; i++) { int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); ItemsTotal[a - 1]++; ItemsTotal[b - 1]++; ItemsTotal[c - 1]++; } int powerUp = 0; int other = 0; for (int i = 0; i < 10; i++) { if (ItemsTotal[i] >= 2) { powerUp += ItemsTotal[i] / 2; } other += ItemsTotal[i] % 2; } int maxPowerUp = powerUp + (other / 4); //int maxPowerUp = other / 4; System.out.println(maxPowerUp); } }