結果
問題 | No.227 簡単ポーカー |
ユーザー |
![]() |
提出日時 | 2018-05-19 13:59:48 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 135 ms / 5,000 ms |
コード長 | 973 bytes |
コンパイル時間 | 2,316 ms |
コンパイル使用メモリ | 78,800 KB |
実行使用メモリ | 41,508 KB |
最終ジャッジ日時 | 2024-06-28 14:22:38 |
合計ジャッジ時間 | 4,894 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 14 |
ソースコード
import java.util.Map; import java.util.Scanner; import java.util.TreeMap; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); Map<Integer,Integer> map=new TreeMap<Integer,Integer>(); for(int i=0;i<5;i++) { int buf=sc.nextInt(); if(map.containsKey(buf)) { map.put(buf,map.get(buf)+1); }else { map.put(buf,1); } } int CountTree=0; int CountTwo=0; for(Integer i:map.values()) { if(i.intValue()==3) { CountTree++; }else if(i.intValue()==2){ CountTwo++; } } String result=null; if(CountTree==1 && CountTwo==1) { result="FULL HOUSE"; }else if(CountTree==1) { result="THREE CARD"; }else if(CountTwo==2) { result="TWO PAIR"; }else if(CountTwo==1) { result="ONE PAIR"; }else { result="NO HAND"; } System.out.println(result); } }