結果
問題 | No.313 π |
ユーザー |
|
提出日時 | 2016-03-07 03:19:36 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 254 ms / 5,000 ms |
コード長 | 708 bytes |
コンパイル時間 | 2,549 ms |
コンパイル使用メモリ | 76,920 KB |
実行使用メモリ | 58,184 KB |
最終ジャッジ日時 | 2024-09-24 15:05:00 |
合計ジャッジ時間 | 11,723 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 |
ソースコード
import java.io.PrintWriter; import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { PrintWriter pw=new PrintWriter(System.out); Scanner sc=new Scanner(System.in); int[] num={20104,20063,19892,20011,19874,20199,19898,20163,19956,19841}; String s=sc.next(); char[] c=new char[s.length()]; int cnt[]=new int[10]; for(int i=0;i<s.length();i++){ try{ cnt[Character.getNumericValue(s.charAt(i))]++; }catch(Exception e){ } } int wrong=0,correct=0; for(int i=0;i<10;i++){ if(num[i]-1==cnt[i]){ correct=i; } if(num[i]+1==cnt[i]){ wrong=i; } } pw.println(wrong+" "+correct); sc.close(); pw.close(); } }