結果

問題 No.29 パワーアップ
ユーザー めうめう🎒
提出日時 2016-05-09 21:50:11
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 839 bytes
コンパイル時間 2,250 ms
コンパイル使用メモリ 77,792 KB
実行使用メモリ 54,272 KB
最終ジャッジ日時 2024-10-05 13:15:44
合計ジャッジ時間 5,701 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

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 / 3;
		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());
	}
}
0