結果

問題 No.313 π
ユーザー GrenacheGrenache
提出日時 2015-12-06 01:05:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 5,000 ms
コード長 2,127 bytes
コンパイル時間 3,426 ms
コンパイル使用メモリ 75,392 KB
実行使用メモリ 53,660 KB
最終ジャッジ日時 2023-10-12 16:21:00
合計ジャッジ時間 8,861 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
52,952 KB
testcase_01 AC 123 ms
53,076 KB
testcase_02 AC 111 ms
52,636 KB
testcase_03 AC 113 ms
52,792 KB
testcase_04 AC 116 ms
52,576 KB
testcase_05 AC 114 ms
52,908 KB
testcase_06 AC 110 ms
53,076 KB
testcase_07 AC 113 ms
52,836 KB
testcase_08 AC 101 ms
53,036 KB
testcase_09 AC 111 ms
53,356 KB
testcase_10 AC 120 ms
53,216 KB
testcase_11 AC 123 ms
53,024 KB
testcase_12 AC 120 ms
53,476 KB
testcase_13 AC 122 ms
53,568 KB
testcase_14 AC 123 ms
52,916 KB
testcase_15 AC 121 ms
52,920 KB
testcase_16 AC 117 ms
53,132 KB
testcase_17 AC 117 ms
53,460 KB
testcase_18 AC 119 ms
52,804 KB
testcase_19 AC 117 ms
53,124 KB
testcase_20 AC 117 ms
53,024 KB
testcase_21 AC 121 ms
52,912 KB
testcase_22 AC 117 ms
53,068 KB
testcase_23 AC 118 ms
53,172 KB
testcase_24 AC 116 ms
53,236 KB
testcase_25 AC 118 ms
53,332 KB
testcase_26 AC 117 ms
53,428 KB
testcase_27 AC 118 ms
53,172 KB
testcase_28 AC 121 ms
51,056 KB
testcase_29 AC 119 ms
52,860 KB
testcase_30 AC 124 ms
51,184 KB
testcase_31 AC 118 ms
53,484 KB
testcase_32 AC 121 ms
53,660 KB
testcase_33 AC 120 ms
52,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Iterator;


public class Main_yukicoder313_1 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Printer pr = new Printer(System.out);

        int[] cnt = {20104, 20063, 19892, 20010, 19874, 20199, 19898, 20163, 19956, 19841};
        char[] s = sc.next().toCharArray();

        if (s[0] != '3') {
        	pr.printf("%c %c\n", s[0], '3');
        } else {
            int[] tmp = new int[10];
            for (int i = 2; i < s.length; i++) {
            	tmp[s[i] - '0']++;
            }

            char c = '0';
            char w = '0';
            for (int i = 0; i < 10; i++) {
            	if (cnt[i] > tmp[i]) {
                	c += i;
            	} else if (cnt[i] < tmp[i]) {
            		w += i;
            	}
            }
        	pr.printf("%c %c\n", w, c);
        }

		pr.close();
        sc.close();
    }

	@SuppressWarnings("unused")
	private static class Scanner {
		BufferedReader br;
		Iterator<String> it;

		Scanner (InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}

		String next() throws RuntimeException  {
			try {
				if (it == null || !it.hasNext()) {
					it = Arrays.asList(br.readLine().split(" ")).iterator();
				}
				return it.next();
			} catch (IOException e) {
				throw new IllegalStateException();
			}
		}

		int nextInt() throws RuntimeException {
			return Integer.parseInt(next());
		}

		long nextLong() throws RuntimeException {
			return Long.parseLong(next());
		}

		float nextFloat() throws RuntimeException {
			return Float.parseFloat(next());
		}

		double nextDouble() throws RuntimeException {
			return Double.parseDouble(next());
		}

		void close() {
			try {
				br.close();
			} catch (IOException e) {
//				throw new IllegalStateException();
			}
		}
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0