結果

問題 No.29 パワーアップ
ユーザー threepipes_sthreepipes_s
提出日時 2015-02-17 00:35:18
言語 Java17
(openjdk 17.0.1)
結果
AC  
実行時間 52 ms / 5,000 ms
コード長 2,074 bytes
コンパイル時間 1,907 ms
使用メモリ 41,744 KB
最終ジャッジ日時 2023-01-21 10:35:59
合計ジャッジ時間 3,998 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 50 ms
39,576 KB
testcase_01 AC 50 ms
38,560 KB
testcase_02 AC 48 ms
41,744 KB
testcase_03 AC 49 ms
39,704 KB
testcase_04 AC 49 ms
41,568 KB
testcase_05 AC 51 ms
39,640 KB
testcase_06 AC 51 ms
39,476 KB
testcase_07 AC 49 ms
41,728 KB
testcase_08 AC 48 ms
41,520 KB
testcase_09 AC 50 ms
39,476 KB
testcase_10 AC 49 ms
39,544 KB
testcase_11 AC 51 ms
39,500 KB
testcase_12 AC 51 ms
39,652 KB
testcase_13 AC 52 ms
39,804 KB
testcase_14 AC 52 ms
39,600 KB
testcase_15 AC 52 ms
39,472 KB
testcase_16 AC 51 ms
39,672 KB
testcase_17 AC 51 ms
39,484 KB
testcase_18 AC 52 ms
41,684 KB
testcase_19 AC 52 ms
39,740 KB
testcase_20 AC 51 ms
39,460 KB
testcase_21 AC 50 ms
39,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.TreeSet;
public class Main {
	public static boolean result[];
	public static int dp[][];
	public static void main(String[] args) throws NumberFormatException, IOException{
		ContestScanner in = new ContestScanner();
		int n = in.nextInt();
		int[] item = new int[10];
		for(int i=0; i<n; i++){
			for(int j=0; j<3; j++){
				item[in.nextInt()-1]++;
			}
		}
		int up = 0;
		int res = 0;
		for(int i=0; i<10; i++){
			up += item[i]/2;
			if(item[i]%2 == 1) res++;
		}
		up += res/4;
		System.out.println(up);
	}
}

class MyComp implements Comparator<int[]>{
	public int compare(int[] a, int[] b) {
		return a[0] - b[0];
	}
}

class Reverse implements Comparator<Integer>{
	public int compare(Integer arg0, Integer arg1) {
		return arg1 - arg0;
	}
}

class Node{
	int id;
	List<Node> edge = new ArrayList<Node>();
	public Node(int id){
		this.id = id;
	}
	public void createEdge(Node node){
		edge.add(node);
	}
}

class ContestScanner{
	private BufferedReader reader;
	private String[] line;
	private int idx;
	public ContestScanner() throws FileNotFoundException{
		reader = new BufferedReader(new InputStreamReader(System.in));
	}

	public ContestScanner(String filename) throws FileNotFoundException{
		reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
	}
	
	public String nextToken() throws IOException{
		if(line == null || line.length <= idx){
			line = reader.readLine().trim().split(" ");
			idx = 0;
		}
		return line[idx++];
	}
	public long nextLong() throws IOException, NumberFormatException{
		return Long.parseLong(nextToken());
	}
	public int nextInt() throws NumberFormatException, IOException{
		return (int)nextLong();
	}
	public double nextDouble() throws NumberFormatException, IOException{
		return Double.parseDouble(nextToken());
	}
}
0