結果
問題 | No.428 小数から逃げる夢 |
ユーザー | yuya178 |
提出日時 | 2017-06-22 23:59:06 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 51 ms / 1,000 ms |
コード長 | 3,313 bytes |
コンパイル時間 | 2,172 ms |
コンパイル使用メモリ | 78,940 KB |
実行使用メモリ | 37,328 KB |
最終ジャッジ日時 | 2024-10-02 12:24:45 |
合計ジャッジ時間 | 9,037 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 47 ms
37,284 KB |
testcase_01 | AC | 51 ms
37,200 KB |
testcase_02 | AC | 49 ms
36,864 KB |
testcase_03 | AC | 47 ms
36,740 KB |
testcase_04 | AC | 46 ms
36,796 KB |
testcase_05 | AC | 46 ms
37,060 KB |
testcase_06 | AC | 47 ms
37,192 KB |
testcase_07 | AC | 47 ms
37,088 KB |
testcase_08 | AC | 47 ms
37,064 KB |
testcase_09 | AC | 46 ms
37,200 KB |
testcase_10 | AC | 46 ms
37,244 KB |
testcase_11 | AC | 48 ms
36,896 KB |
testcase_12 | AC | 47 ms
37,200 KB |
testcase_13 | AC | 48 ms
36,760 KB |
testcase_14 | AC | 45 ms
37,268 KB |
testcase_15 | AC | 46 ms
36,704 KB |
testcase_16 | AC | 46 ms
37,108 KB |
testcase_17 | AC | 45 ms
37,056 KB |
testcase_18 | AC | 45 ms
36,824 KB |
testcase_19 | AC | 45 ms
37,076 KB |
testcase_20 | AC | 46 ms
36,716 KB |
testcase_21 | AC | 45 ms
36,792 KB |
testcase_22 | AC | 46 ms
37,192 KB |
testcase_23 | AC | 46 ms
37,076 KB |
testcase_24 | AC | 47 ms
36,976 KB |
testcase_25 | AC | 47 ms
36,928 KB |
testcase_26 | AC | 48 ms
37,236 KB |
testcase_27 | AC | 49 ms
37,212 KB |
testcase_28 | AC | 46 ms
37,200 KB |
testcase_29 | AC | 46 ms
36,800 KB |
testcase_30 | AC | 46 ms
36,824 KB |
testcase_31 | AC | 51 ms
37,116 KB |
testcase_32 | AC | 49 ms
36,796 KB |
testcase_33 | AC | 47 ms
37,100 KB |
testcase_34 | AC | 45 ms
36,800 KB |
testcase_35 | AC | 45 ms
36,868 KB |
testcase_36 | AC | 46 ms
37,116 KB |
testcase_37 | AC | 45 ms
36,976 KB |
testcase_38 | AC | 45 ms
37,188 KB |
testcase_39 | AC | 46 ms
37,068 KB |
testcase_40 | AC | 46 ms
37,328 KB |
testcase_41 | AC | 46 ms
37,080 KB |
testcase_42 | AC | 46 ms
37,200 KB |
testcase_43 | AC | 44 ms
36,872 KB |
testcase_44 | AC | 47 ms
37,248 KB |
testcase_45 | AC | 48 ms
36,760 KB |
testcase_46 | AC | 47 ms
37,016 KB |
testcase_47 | AC | 47 ms
36,972 KB |
testcase_48 | AC | 47 ms
37,152 KB |
testcase_49 | AC | 49 ms
36,968 KB |
testcase_50 | AC | 46 ms
36,960 KB |
testcase_51 | AC | 45 ms
37,108 KB |
testcase_52 | AC | 45 ms
37,044 KB |
testcase_53 | AC | 46 ms
36,808 KB |
testcase_54 | AC | 47 ms
37,012 KB |
testcase_55 | AC | 47 ms
37,256 KB |
testcase_56 | AC | 46 ms
36,832 KB |
testcase_57 | AC | 50 ms
36,864 KB |
testcase_58 | AC | 46 ms
37,176 KB |
testcase_59 | AC | 45 ms
37,040 KB |
testcase_60 | AC | 46 ms
37,244 KB |
testcase_61 | AC | 45 ms
37,100 KB |
testcase_62 | AC | 47 ms
36,976 KB |
testcase_63 | AC | 46 ms
36,896 KB |
testcase_64 | AC | 45 ms
36,920 KB |
testcase_65 | AC | 48 ms
37,096 KB |
testcase_66 | AC | 45 ms
36,836 KB |
testcase_67 | AC | 46 ms
36,916 KB |
testcase_68 | AC | 46 ms
36,928 KB |
testcase_69 | AC | 46 ms
37,072 KB |
testcase_70 | AC | 46 ms
37,036 KB |
testcase_71 | AC | 48 ms
36,788 KB |
testcase_72 | AC | 47 ms
37,116 KB |
testcase_73 | AC | 46 ms
37,156 KB |
testcase_74 | AC | 46 ms
37,100 KB |
testcase_75 | AC | 46 ms
36,964 KB |
testcase_76 | AC | 45 ms
37,200 KB |
testcase_77 | AC | 46 ms
36,796 KB |
testcase_78 | AC | 46 ms
37,116 KB |
testcase_79 | AC | 46 ms
36,884 KB |
testcase_80 | AC | 46 ms
37,236 KB |
testcase_81 | AC | 48 ms
37,204 KB |
testcase_82 | AC | 48 ms
37,012 KB |
testcase_83 | AC | 50 ms
37,236 KB |
testcase_84 | AC | 45 ms
36,828 KB |
testcase_85 | AC | 45 ms
36,764 KB |
testcase_86 | AC | 45 ms
37,116 KB |
testcase_87 | AC | 48 ms
37,064 KB |
testcase_88 | AC | 46 ms
37,068 KB |
testcase_89 | AC | 48 ms
37,064 KB |
testcase_90 | AC | 48 ms
36,876 KB |
testcase_91 | AC | 45 ms
37,244 KB |
testcase_92 | AC | 46 ms
36,744 KB |
testcase_93 | AC | 46 ms
37,204 KB |
testcase_94 | AC | 46 ms
37,080 KB |
testcase_95 | AC | 45 ms
37,164 KB |
testcase_96 | AC | 45 ms
37,040 KB |
testcase_97 | AC | 45 ms
36,744 KB |
testcase_98 | AC | 49 ms
36,784 KB |
testcase_99 | AC | 48 ms
36,756 KB |
ソースコード
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.io.OutputStream; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; import java.util.ArrayList; import java.util.List; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); Task solver = new Task(); solver.solve(1, in, out); out.close(); } static class Task { public void solve(int testNumber, InputReader in, PrintWriter out) { String D = "0.1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991"; int N = in.nextInt(); int[] ichi = new int[D.length()+1]; int[] ni = new int[D.length()+1]; int first = N%10; int second = N/10; int c=0; for(int i=D.length(); i>=3; i--){ ichi[i]=(first*(D.charAt(i-1)-'0')+c)%10; c=(first*(D.charAt(i-1)-'0')+c)/10; } ichi[2] = c; c=0; ni[D.length()]=0; for(int i=D.length(); i>=3; i--){ ni[i-1]=(second*(D.charAt(i-1)-'0')+c)%10; c=(second*(D.charAt(i-1)-'0')+c)/10; } ni[1] = c; c=0; int[] res = new int[D.length()+1]; for(int i=D.length(); i>=0; i--){ res[i] = (ichi[i]+ni[i]+c)%10; c=(ichi[i]+ni[i]+c)/10; } if(N==100){ for(int i=0; i<D.length()-2; i++){ res[i+1] = (D.charAt(i+2)-'0'); } } int flag=0; for(int i=0; i<=D.length(); i++){ if(flag==0 && res[i]==0 && i<2) continue; flag=1; if(i==3) out.print("."); out.print(res[i]); } } } static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); tokenizer = null; } public String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } } }