結果
| 問題 |
No.29 パワーアップ
|
| コンテスト | |
| ユーザー |
めうめう🎒
|
| 提出日時 | 2016-05-09 21:51:51 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 134 ms / 5,000 ms |
| コード長 | 838 bytes |
| コンパイル時間 | 2,453 ms |
| コンパイル使用メモリ | 80,600 KB |
| 実行使用メモリ | 46,636 KB |
| 最終ジャッジ日時 | 2025-10-24 20:57:10 |
| 合計ジャッジ時間 | 5,815 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 |
ソースコード
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Queue;
import java.util.Scanner;
public class Main {
private int n;
private int[] how;
Main(){
how = new int[11];
}
public void setN(int n){
this.n = n;
}
public void plusHow(int a,int b,int c){
this.how[a]++;
this.how[b]++;
this.how[c]++;
}
public int ans(){
int last = 0;
int ans = 0;
for(int i = 0;i < 10;i++){
ans += how[i] / 2;
last += how[i] % 2;
}
ans += last / 4;
return ans;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Main m = new Main();
int n = sc.nextInt();
m.setN(n);
int a,b,c;
for(int i = 0;i < n;i++){
a = sc.nextInt();
b = sc.nextInt();
c = sc.nextInt();
a--;
b--;
c--;
m.plusHow(a, b, c);
}
System.out.println(m.ans());
}
}
めうめう🎒