結果

問題 No.29 パワーアップ
ユーザー めうめう🎒めうめう🎒
提出日時 2016-05-09 21:50:11
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 839 bytes
コンパイル時間 2,280 ms
コンパイル使用メモリ 77,816 KB
実行使用メモリ 54,472 KB
最終ジャッジ日時 2024-04-15 14:59:15
合計ジャッジ時間 6,139 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
54,064 KB
testcase_01 AC 134 ms
54,176 KB
testcase_02 AC 133 ms
54,068 KB
testcase_03 AC 137 ms
53,940 KB
testcase_04 AC 134 ms
54,116 KB
testcase_05 AC 145 ms
54,172 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 142 ms
54,336 KB
testcase_09 WA -
testcase_10 AC 151 ms
54,408 KB
testcase_11 AC 155 ms
54,240 KB
testcase_12 AC 139 ms
54,032 KB
testcase_13 WA -
testcase_14 AC 147 ms
54,168 KB
testcase_15 WA -
testcase_16 AC 151 ms
54,056 KB
testcase_17 AC 139 ms
54,076 KB
testcase_18 AC 142 ms
53,944 KB
testcase_19 AC 141 ms
53,984 KB
testcase_20 AC 132 ms
54,060 KB
testcase_21 AC 132 ms
53,788 KB
権限があれば一括ダウンロードができます

ソースコード

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