結果

問題 No.29 パワーアップ
ユーザー fal_rndfal_rnd
提出日時 2017-08-08 18:50:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 5,000 ms
コード長 607 bytes
コンパイル時間 2,588 ms
コンパイル使用メモリ 80,500 KB
実行使用メモリ 41,748 KB
最終ジャッジ日時 2024-04-20 05:15:21
合計ジャッジ時間 5,690 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
41,456 KB
testcase_01 AC 124 ms
41,264 KB
testcase_02 AC 118 ms
41,340 KB
testcase_03 AC 123 ms
41,592 KB
testcase_04 AC 119 ms
41,208 KB
testcase_05 AC 129 ms
41,468 KB
testcase_06 AC 128 ms
41,684 KB
testcase_07 AC 129 ms
41,320 KB
testcase_08 AC 121 ms
41,160 KB
testcase_09 AC 118 ms
41,420 KB
testcase_10 AC 137 ms
41,184 KB
testcase_11 AC 134 ms
41,560 KB
testcase_12 AC 121 ms
41,448 KB
testcase_13 AC 131 ms
41,576 KB
testcase_14 AC 130 ms
41,636 KB
testcase_15 AC 131 ms
41,716 KB
testcase_16 AC 124 ms
41,620 KB
testcase_17 AC 114 ms
40,712 KB
testcase_18 AC 128 ms
41,364 KB
testcase_19 AC 127 ms
41,748 KB
testcase_20 AC 107 ms
40,384 KB
testcase_21 AC 121 ms
41,208 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