結果
問題 | No.29 パワーアップ |
ユーザー |
![]() |
提出日時 | 2017-08-08 18:50:52 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 141 ms / 5,000 ms |
コード長 | 607 bytes |
コンパイル時間 | 2,274 ms |
コンパイル使用メモリ | 81,064 KB |
実行使用メモリ | 41,980 KB |
最終ジャッジ日時 | 2024-10-12 00:15:14 |
合計ジャッジ時間 | 6,171 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
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() ); } }