結果

問題 No.29 パワーアップ
ユーザー threepipes_sthreepipes_s
提出日時 2015-02-17 00:35:18
言語 Java19
(openjdk 21)
結果
AC  
実行時間 43 ms / 5,000 ms
コード長 2,074 bytes
コンパイル時間 1,907 ms
コンパイル使用メモリ 75,296 KB
実行使用メモリ 49,760 KB
最終ジャッジ日時 2023-09-06 00:40:30
合計ジャッジ時間 3,908 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
49,692 KB
testcase_01 AC 40 ms
49,432 KB
testcase_02 AC 40 ms
49,312 KB
testcase_03 AC 39 ms
49,424 KB
testcase_04 AC 40 ms
49,412 KB
testcase_05 AC 42 ms
49,628 KB
testcase_06 AC 41 ms
49,544 KB
testcase_07 AC 41 ms
47,392 KB
testcase_08 AC 41 ms
49,760 KB
testcase_09 AC 40 ms
49,420 KB
testcase_10 AC 41 ms
49,504 KB
testcase_11 AC 42 ms
49,408 KB
testcase_12 AC 40 ms
49,340 KB
testcase_13 AC 40 ms
49,376 KB
testcase_14 AC 39 ms
49,376 KB
testcase_15 AC 39 ms
49,412 KB
testcase_16 AC 40 ms
49,592 KB
testcase_17 AC 38 ms
49,552 KB
testcase_18 AC 41 ms
49,612 KB
testcase_19 AC 39 ms
49,716 KB
testcase_20 AC 43 ms
49,508 KB
testcase_21 AC 41 ms
49,312 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