結果

問題 No.747 循環小数N桁目 Hard
ユーザー hiromi_ayasehiromi_ayase
提出日時 2018-10-20 14:22:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 410 ms / 2,000 ms
コード長 2,898 bytes
コンパイル時間 2,526 ms
コンパイル使用メモリ 78,676 KB
実行使用メモリ 56,984 KB
最終ジャッジ日時 2023-08-12 05:11:48
合計ジャッジ時間 25,554 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
50,832 KB
testcase_01 AC 63 ms
51,384 KB
testcase_02 AC 64 ms
50,920 KB
testcase_03 AC 63 ms
50,780 KB
testcase_04 AC 63 ms
50,868 KB
testcase_05 AC 63 ms
51,248 KB
testcase_06 AC 61 ms
50,820 KB
testcase_07 AC 66 ms
50,852 KB
testcase_08 AC 63 ms
50,856 KB
testcase_09 AC 63 ms
50,956 KB
testcase_10 AC 65 ms
50,948 KB
testcase_11 AC 65 ms
50,848 KB
testcase_12 AC 63 ms
50,824 KB
testcase_13 AC 63 ms
50,956 KB
testcase_14 AC 65 ms
50,924 KB
testcase_15 AC 63 ms
50,800 KB
testcase_16 AC 62 ms
50,800 KB
testcase_17 AC 62 ms
51,040 KB
testcase_18 AC 65 ms
51,340 KB
testcase_19 AC 63 ms
50,988 KB
testcase_20 AC 64 ms
51,344 KB
testcase_21 AC 64 ms
50,824 KB
testcase_22 AC 64 ms
51,320 KB
testcase_23 AC 65 ms
51,172 KB
testcase_24 AC 63 ms
50,864 KB
testcase_25 AC 64 ms
49,140 KB
testcase_26 AC 66 ms
51,144 KB
testcase_27 AC 62 ms
50,844 KB
testcase_28 AC 65 ms
50,892 KB
testcase_29 AC 64 ms
50,820 KB
testcase_30 AC 62 ms
50,936 KB
testcase_31 AC 62 ms
50,808 KB
testcase_32 AC 62 ms
50,900 KB
testcase_33 AC 170 ms
53,408 KB
testcase_34 AC 100 ms
53,120 KB
testcase_35 AC 100 ms
53,140 KB
testcase_36 AC 122 ms
53,180 KB
testcase_37 AC 87 ms
52,836 KB
testcase_38 AC 115 ms
52,872 KB
testcase_39 AC 102 ms
53,276 KB
testcase_40 AC 178 ms
52,908 KB
testcase_41 AC 182 ms
53,152 KB
testcase_42 AC 166 ms
53,164 KB
testcase_43 AC 110 ms
53,088 KB
testcase_44 AC 151 ms
52,732 KB
testcase_45 AC 165 ms
52,908 KB
testcase_46 AC 163 ms
53,060 KB
testcase_47 AC 164 ms
52,800 KB
testcase_48 AC 123 ms
53,132 KB
testcase_49 AC 144 ms
53,068 KB
testcase_50 AC 120 ms
53,080 KB
testcase_51 AC 117 ms
52,984 KB
testcase_52 AC 98 ms
52,900 KB
testcase_53 AC 385 ms
56,592 KB
testcase_54 AC 271 ms
53,320 KB
testcase_55 AC 329 ms
56,000 KB
testcase_56 AC 273 ms
54,636 KB
testcase_57 AC 107 ms
53,248 KB
testcase_58 AC 410 ms
56,984 KB
testcase_59 AC 143 ms
53,076 KB
testcase_60 AC 313 ms
54,820 KB
testcase_61 AC 203 ms
52,932 KB
testcase_62 AC 221 ms
53,076 KB
testcase_63 AC 171 ms
53,124 KB
testcase_64 AC 116 ms
53,236 KB
testcase_65 AC 84 ms
52,700 KB
testcase_66 AC 143 ms
53,256 KB
testcase_67 AC 136 ms
52,840 KB
testcase_68 AC 150 ms
52,748 KB
testcase_69 AC 162 ms
52,848 KB
testcase_70 AC 102 ms
52,944 KB
testcase_71 AC 102 ms
53,028 KB
testcase_72 AC 119 ms
52,852 KB
testcase_73 AC 155 ms
52,904 KB
testcase_74 AC 157 ms
52,704 KB
testcase_75 AC 112 ms
53,484 KB
testcase_76 AC 124 ms
53,004 KB
testcase_77 AC 112 ms
52,896 KB
testcase_78 AC 150 ms
53,080 KB
testcase_79 AC 150 ms
52,792 KB
testcase_80 AC 171 ms
53,032 KB
testcase_81 AC 99 ms
53,148 KB
testcase_82 AC 123 ms
52,880 KB
testcase_83 AC 108 ms
53,188 KB
testcase_84 AC 187 ms
53,048 KB
testcase_85 AC 166 ms
53,168 KB
testcase_86 AC 142 ms
53,236 KB
testcase_87 AC 185 ms
52,976 KB
testcase_88 AC 122 ms
52,912 KB
testcase_89 AC 130 ms
53,008 KB
testcase_90 AC 155 ms
52,724 KB
testcase_91 AC 159 ms
53,156 KB
testcase_92 AC 144 ms
53,156 KB
testcase_93 AC 170 ms
53,120 KB
testcase_94 AC 241 ms
52,964 KB
testcase_95 AC 311 ms
54,932 KB
testcase_96 AC 258 ms
53,104 KB
testcase_97 AC 339 ms
54,528 KB
testcase_98 AC 409 ms
56,736 KB
testcase_99 AC 342 ms
56,720 KB
testcase_100 AC 298 ms
54,324 KB
testcase_101 AC 185 ms
52,984 KB
testcase_102 AC 167 ms
53,068 KB
testcase_103 AC 213 ms
53,128 KB
testcase_104 AC 207 ms
52,988 KB
testcase_105 AC 207 ms
52,728 KB
testcase_106 AC 209 ms
53,060 KB
testcase_107 AC 208 ms
52,808 KB
testcase_108 AC 211 ms
52,888 KB
testcase_109 AC 207 ms
52,808 KB
testcase_110 AC 209 ms
52,984 KB
testcase_111 AC 209 ms
52,892 KB
testcase_112 AC 205 ms
52,916 KB
testcase_113 AC 208 ms
52,928 KB
testcase_114 AC 216 ms
52,752 KB
testcase_115 AC 214 ms
52,804 KB
testcase_116 AC 213 ms
52,984 KB
testcase_117 AC 209 ms
53,068 KB
testcase_118 AC 211 ms
53,232 KB
testcase_119 AC 207 ms
52,996 KB
testcase_120 AC 211 ms
52,784 KB
testcase_121 AC 206 ms
52,980 KB
testcase_122 AC 204 ms
53,284 KB
testcase_123 AC 206 ms
52,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.BigInteger;

public class Main {


  private static void solve() {
    BigInteger n = new BigInteger(next());
    BigInteger k = new BigInteger(next());
    
    int n2 = n.mod(BigInteger.valueOf(2)).intValue();
    int n3 = n.mod(BigInteger.valueOf(3)).intValue();
    int k3 = k.mod(BigInteger.valueOf(2)).intValue();
    
    int nx = n2;
    int kx = n3 == 0 ? 0 : (k3 == 0 ? 1 : n3);
    //{0,4,2},{3,1,5}
    int d = new int[][]{{0,4,2},{3,1,5}}[nx][kx];
    String s = "285714";
    System.out.println(s.charAt((d + 5) % 6));
  }
  

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}
0