結果
問題 | No.757 チャンパーノウン定数 (2) |
ユーザー | nebukuro09 |
提出日時 | 2018-12-05 10:32:47 |
言語 | PyPy2 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 749 bytes |
コンパイル時間 | 972 ms |
コンパイル使用メモリ | 77,844 KB |
実行使用メモリ | 80,868 KB |
最終ジャッジ日時 | 2023-09-25 12:54:50 |
合計ジャッジ時間 | 11,704 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 162 ms
78,860 KB |
testcase_01 | AC | 75 ms
76,376 KB |
testcase_02 | AC | 122 ms
77,892 KB |
testcase_03 | AC | 76 ms
77,108 KB |
testcase_04 | AC | 162 ms
78,964 KB |
testcase_05 | AC | 164 ms
79,232 KB |
testcase_06 | AC | 194 ms
79,756 KB |
testcase_07 | AC | 80 ms
78,172 KB |
testcase_08 | AC | 215 ms
80,196 KB |
testcase_09 | AC | 212 ms
80,780 KB |
testcase_10 | AC | 77 ms
76,184 KB |
testcase_11 | AC | 124 ms
77,740 KB |
testcase_12 | AC | 80 ms
77,240 KB |
testcase_13 | AC | 161 ms
78,708 KB |
testcase_14 | AC | 164 ms
79,228 KB |
testcase_15 | AC | 194 ms
80,240 KB |
testcase_16 | AC | 80 ms
78,548 KB |
testcase_17 | AC | 214 ms
80,868 KB |
testcase_18 | AC | 210 ms
80,748 KB |
testcase_19 | AC | 76 ms
76,340 KB |
testcase_20 | AC | 124 ms
77,616 KB |
testcase_21 | AC | 80 ms
77,680 KB |
testcase_22 | AC | 163 ms
78,932 KB |
testcase_23 | AC | 163 ms
79,576 KB |
testcase_24 | AC | 195 ms
79,744 KB |
testcase_25 | AC | 81 ms
78,452 KB |
testcase_26 | AC | 216 ms
80,452 KB |
testcase_27 | AC | 211 ms
80,724 KB |
testcase_28 | TLE | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
testcase_49 | -- | - |
testcase_50 | -- | - |
testcase_51 | -- | - |
testcase_52 | -- | - |
testcase_53 | -- | - |
ソースコード
B = int(raw_input()) C = raw_input() D = 0 b = 1 for i in xrange(len(C)-1, -1, -1): D += b * int(C[i]) b *= B def f(n): if n == 0: return 0 else: return n * B ** n - (B ** n - 1) / (B - 1) def solve1(): hi = 10**6 lo = 0 while hi - lo > 1: mid = (hi + lo) / 2 if f(mid) >= D: hi = mid else: lo = mid return hi def solve2(): keta = solve1() x = f(keta-1) a = B ** (keta-1) b = B ** keta - 1 hi = (D - x) / keta + ((D - x) % keta > 0) lo = hi - 1 x += lo * keta s = [] hi += a - 1 while hi > 0: s.append(str(hi % B)) hi /= B s.reverse() #print x, D, s return s[D-x-1] print solve2()