結果

問題 No.428 小数から逃げる夢
ユーザー yuya178yuya178
提出日時 2017-06-22 23:55:30
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 3,311 bytes
コンパイル時間 2,396 ms
コンパイル使用メモリ 79,176 KB
実行使用メモリ 37,468 KB
最終ジャッジ日時 2024-10-02 12:24:06
合計ジャッジ時間 9,868 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
37,244 KB
testcase_01 AC 50 ms
37,212 KB
testcase_02 AC 50 ms
37,204 KB
testcase_03 AC 51 ms
37,076 KB
testcase_04 AC 51 ms
37,292 KB
testcase_05 AC 54 ms
36,760 KB
testcase_06 AC 54 ms
36,764 KB
testcase_07 AC 51 ms
37,260 KB
testcase_08 AC 50 ms
37,428 KB
testcase_09 AC 51 ms
36,960 KB
testcase_10 AC 50 ms
37,324 KB
testcase_11 AC 53 ms
37,064 KB
testcase_12 AC 50 ms
37,300 KB
testcase_13 AC 49 ms
36,976 KB
testcase_14 AC 50 ms
37,212 KB
testcase_15 AC 51 ms
36,748 KB
testcase_16 AC 50 ms
36,952 KB
testcase_17 AC 51 ms
37,268 KB
testcase_18 AC 50 ms
37,248 KB
testcase_19 AC 48 ms
37,384 KB
testcase_20 AC 50 ms
37,212 KB
testcase_21 AC 52 ms
36,972 KB
testcase_22 AC 50 ms
37,068 KB
testcase_23 AC 49 ms
37,428 KB
testcase_24 AC 50 ms
36,956 KB
testcase_25 AC 52 ms
36,972 KB
testcase_26 AC 52 ms
36,744 KB
testcase_27 AC 51 ms
36,828 KB
testcase_28 AC 51 ms
37,212 KB
testcase_29 AC 52 ms
37,136 KB
testcase_30 AC 52 ms
36,760 KB
testcase_31 AC 50 ms
36,828 KB
testcase_32 AC 51 ms
37,188 KB
testcase_33 AC 50 ms
36,892 KB
testcase_34 AC 49 ms
37,068 KB
testcase_35 AC 51 ms
37,152 KB
testcase_36 AC 51 ms
36,668 KB
testcase_37 AC 51 ms
36,724 KB
testcase_38 AC 51 ms
37,056 KB
testcase_39 AC 51 ms
36,968 KB
testcase_40 AC 51 ms
37,288 KB
testcase_41 AC 51 ms
37,148 KB
testcase_42 AC 50 ms
37,052 KB
testcase_43 AC 50 ms
37,140 KB
testcase_44 AC 54 ms
37,152 KB
testcase_45 AC 50 ms
36,948 KB
testcase_46 AC 53 ms
36,764 KB
testcase_47 AC 50 ms
37,240 KB
testcase_48 AC 51 ms
37,240 KB
testcase_49 AC 50 ms
37,468 KB
testcase_50 AC 52 ms
36,884 KB
testcase_51 AC 51 ms
37,200 KB
testcase_52 AC 48 ms
37,344 KB
testcase_53 AC 49 ms
36,884 KB
testcase_54 AC 51 ms
37,020 KB
testcase_55 AC 50 ms
37,284 KB
testcase_56 AC 53 ms
36,952 KB
testcase_57 AC 51 ms
37,136 KB
testcase_58 AC 50 ms
37,148 KB
testcase_59 AC 51 ms
37,236 KB
testcase_60 AC 50 ms
36,824 KB
testcase_61 AC 50 ms
37,276 KB
testcase_62 AC 50 ms
37,148 KB
testcase_63 AC 51 ms
37,284 KB
testcase_64 AC 51 ms
37,272 KB
testcase_65 AC 50 ms
37,276 KB
testcase_66 AC 51 ms
37,236 KB
testcase_67 AC 50 ms
37,160 KB
testcase_68 AC 54 ms
37,156 KB
testcase_69 AC 52 ms
36,868 KB
testcase_70 AC 55 ms
37,276 KB
testcase_71 AC 52 ms
37,052 KB
testcase_72 AC 51 ms
37,300 KB
testcase_73 AC 51 ms
37,296 KB
testcase_74 AC 51 ms
37,144 KB
testcase_75 AC 51 ms
37,244 KB
testcase_76 AC 51 ms
37,336 KB
testcase_77 AC 50 ms
37,272 KB
testcase_78 AC 51 ms
36,964 KB
testcase_79 AC 52 ms
37,152 KB
testcase_80 AC 51 ms
36,976 KB
testcase_81 AC 55 ms
36,948 KB
testcase_82 AC 51 ms
37,300 KB
testcase_83 AC 51 ms
37,280 KB
testcase_84 AC 50 ms
37,300 KB
testcase_85 AC 55 ms
37,280 KB
testcase_86 AC 51 ms
37,204 KB
testcase_87 AC 51 ms
36,876 KB
testcase_88 AC 52 ms
36,748 KB
testcase_89 AC 54 ms
37,008 KB
testcase_90 AC 52 ms
37,276 KB
testcase_91 AC 51 ms
36,812 KB
testcase_92 AC 51 ms
37,296 KB
testcase_93 AC 53 ms
37,156 KB
testcase_94 AC 50 ms
37,244 KB
testcase_95 AC 51 ms
36,992 KB
testcase_96 AC 51 ms
37,300 KB
testcase_97 AC 50 ms
36,884 KB
testcase_98 AC 55 ms
37,072 KB
testcase_99 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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] = (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());
        }

    }
}
0