結果

問題 No.747 循環小数N桁目 Hard
ユーザー hiromi_ayasehiromi_ayase
提出日時 2018-10-20 14:22:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 467 ms / 2,000 ms
コード長 2,898 bytes
コンパイル時間 2,708 ms
コンパイル使用メモリ 90,884 KB
実行使用メモリ 43,008 KB
最終ジャッジ日時 2024-11-19 02:34:02
合計ジャッジ時間 28,043 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
38,688 KB
testcase_01 AC 80 ms
38,512 KB
testcase_02 AC 79 ms
38,288 KB
testcase_03 AC 78 ms
38,600 KB
testcase_04 AC 80 ms
38,084 KB
testcase_05 AC 82 ms
38,080 KB
testcase_06 AC 81 ms
38,292 KB
testcase_07 AC 81 ms
38,508 KB
testcase_08 AC 80 ms
38,500 KB
testcase_09 AC 79 ms
38,420 KB
testcase_10 AC 79 ms
38,420 KB
testcase_11 AC 81 ms
38,508 KB
testcase_12 AC 79 ms
38,076 KB
testcase_13 AC 79 ms
38,432 KB
testcase_14 AC 81 ms
38,484 KB
testcase_15 AC 79 ms
38,288 KB
testcase_16 AC 81 ms
38,588 KB
testcase_17 AC 80 ms
38,696 KB
testcase_18 AC 81 ms
38,560 KB
testcase_19 AC 81 ms
38,276 KB
testcase_20 AC 78 ms
38,092 KB
testcase_21 AC 80 ms
38,340 KB
testcase_22 AC 80 ms
38,588 KB
testcase_23 AC 79 ms
38,432 KB
testcase_24 AC 80 ms
38,584 KB
testcase_25 AC 80 ms
38,280 KB
testcase_26 AC 81 ms
38,076 KB
testcase_27 AC 81 ms
38,080 KB
testcase_28 AC 80 ms
38,500 KB
testcase_29 AC 82 ms
38,704 KB
testcase_30 AC 84 ms
38,564 KB
testcase_31 AC 81 ms
38,504 KB
testcase_32 AC 81 ms
38,040 KB
testcase_33 AC 193 ms
40,396 KB
testcase_34 AC 129 ms
40,140 KB
testcase_35 AC 125 ms
39,776 KB
testcase_36 AC 151 ms
39,756 KB
testcase_37 AC 106 ms
39,944 KB
testcase_38 AC 142 ms
39,884 KB
testcase_39 AC 124 ms
39,792 KB
testcase_40 AC 210 ms
40,376 KB
testcase_41 AC 213 ms
40,768 KB
testcase_42 AC 187 ms
40,564 KB
testcase_43 AC 133 ms
39,872 KB
testcase_44 AC 177 ms
40,220 KB
testcase_45 AC 192 ms
40,440 KB
testcase_46 AC 183 ms
40,328 KB
testcase_47 AC 184 ms
40,484 KB
testcase_48 AC 149 ms
40,180 KB
testcase_49 AC 164 ms
40,128 KB
testcase_50 AC 131 ms
39,940 KB
testcase_51 AC 136 ms
40,036 KB
testcase_52 AC 117 ms
39,672 KB
testcase_53 AC 452 ms
42,976 KB
testcase_54 AC 324 ms
42,104 KB
testcase_55 AC 372 ms
42,224 KB
testcase_56 AC 320 ms
42,036 KB
testcase_57 AC 131 ms
39,968 KB
testcase_58 AC 467 ms
42,912 KB
testcase_59 AC 168 ms
40,344 KB
testcase_60 AC 361 ms
42,344 KB
testcase_61 AC 242 ms
40,492 KB
testcase_62 AC 253 ms
40,844 KB
testcase_63 AC 205 ms
40,560 KB
testcase_64 AC 149 ms
39,744 KB
testcase_65 AC 113 ms
39,628 KB
testcase_66 AC 169 ms
40,196 KB
testcase_67 AC 162 ms
40,292 KB
testcase_68 AC 178 ms
40,244 KB
testcase_69 AC 189 ms
40,396 KB
testcase_70 AC 124 ms
40,012 KB
testcase_71 AC 129 ms
39,628 KB
testcase_72 AC 145 ms
40,500 KB
testcase_73 AC 190 ms
40,528 KB
testcase_74 AC 188 ms
40,140 KB
testcase_75 AC 137 ms
39,732 KB
testcase_76 AC 154 ms
40,248 KB
testcase_77 AC 135 ms
39,912 KB
testcase_78 AC 175 ms
40,268 KB
testcase_79 AC 179 ms
40,504 KB
testcase_80 AC 183 ms
40,540 KB
testcase_81 AC 120 ms
39,624 KB
testcase_82 AC 144 ms
39,836 KB
testcase_83 AC 128 ms
40,244 KB
testcase_84 AC 211 ms
40,464 KB
testcase_85 AC 196 ms
40,616 KB
testcase_86 AC 164 ms
40,460 KB
testcase_87 AC 211 ms
40,500 KB
testcase_88 AC 138 ms
40,008 KB
testcase_89 AC 150 ms
40,480 KB
testcase_90 AC 178 ms
40,440 KB
testcase_91 AC 191 ms
40,344 KB
testcase_92 AC 166 ms
40,128 KB
testcase_93 AC 199 ms
40,612 KB
testcase_94 AC 284 ms
41,104 KB
testcase_95 AC 346 ms
42,548 KB
testcase_96 AC 306 ms
42,040 KB
testcase_97 AC 380 ms
42,660 KB
testcase_98 AC 462 ms
43,008 KB
testcase_99 AC 386 ms
42,892 KB
testcase_100 AC 342 ms
42,168 KB
testcase_101 AC 208 ms
40,440 KB
testcase_102 AC 193 ms
40,396 KB
testcase_103 AC 239 ms
40,732 KB
testcase_104 AC 240 ms
40,996 KB
testcase_105 AC 240 ms
40,860 KB
testcase_106 AC 237 ms
40,752 KB
testcase_107 AC 239 ms
40,724 KB
testcase_108 AC 239 ms
40,752 KB
testcase_109 AC 240 ms
40,780 KB
testcase_110 AC 239 ms
40,912 KB
testcase_111 AC 237 ms
40,876 KB
testcase_112 AC 238 ms
40,712 KB
testcase_113 AC 237 ms
40,720 KB
testcase_114 AC 239 ms
40,720 KB
testcase_115 AC 239 ms
40,960 KB
testcase_116 AC 239 ms
40,948 KB
testcase_117 AC 238 ms
40,692 KB
testcase_118 AC 238 ms
40,712 KB
testcase_119 AC 240 ms
40,956 KB
testcase_120 AC 236 ms
40,868 KB
testcase_121 AC 238 ms
40,756 KB
testcase_122 AC 239 ms
41,004 KB
testcase_123 AC 241 ms
40,992 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