結果

問題 No.29 パワーアップ
ユーザー fal_rndfal_rnd
提出日時 2017-08-08 18:50:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 149 ms / 5,000 ms
コード長 607 bytes
コンパイル時間 2,794 ms
コンパイル使用メモリ 85,396 KB
実行使用メモリ 56,228 KB
最終ジャッジ日時 2023-08-02 05:14:44
合計ジャッジ時間 7,005 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
55,560 KB
testcase_01 AC 135 ms
55,192 KB
testcase_02 AC 127 ms
55,356 KB
testcase_03 AC 127 ms
55,468 KB
testcase_04 AC 127 ms
55,776 KB
testcase_05 AC 135 ms
55,428 KB
testcase_06 AC 135 ms
55,648 KB
testcase_07 AC 134 ms
55,692 KB
testcase_08 AC 130 ms
55,460 KB
testcase_09 AC 128 ms
56,228 KB
testcase_10 AC 140 ms
55,364 KB
testcase_11 AC 149 ms
55,648 KB
testcase_12 AC 139 ms
55,572 KB
testcase_13 AC 135 ms
55,200 KB
testcase_14 AC 135 ms
55,472 KB
testcase_15 AC 136 ms
55,688 KB
testcase_16 AC 133 ms
55,136 KB
testcase_17 AC 130 ms
55,108 KB
testcase_18 AC 131 ms
55,424 KB
testcase_19 AC 133 ms
55,476 KB
testcase_20 AC 124 ms
55,332 KB
testcase_21 AC 126 ms
55,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.util.stream.IntStream;
public class Main{
	static Scanner s=new Scanner(System.in);
	static int getInt(){return Integer.parseInt(s.next());}
	static IntStream REPS(int v){return IntStream.range(0,v);}
	static IntStream INS(int n) {return REPS(n).map(i->getInt());}
	public static void main(String[]$){
		HashMap<Integer,Integer>h=new HashMap<>();
		INS(getInt()*3).forEach(i->h.merge(i,1,Integer::sum));

		Collection<Integer>b=h.values();
		System.out.println(
				b.stream()
				.filter(i->i%2==1)
				.count()/4
				+b.stream()
				.mapToInt(i->i/2)
				.sum()
				);
	}
}
0