結果

問題 No.493 とても長い数列と文字列(Long Long Sequence and a String)
ユーザー convexineqconvexineq
提出日時 2021-02-09 07:53:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 860 bytes
コンパイル時間 360 ms
コンパイル使用メモリ 86,968 KB
実行使用メモリ 79,700 KB
最終ジャッジ日時 2023-09-20 18:31:15
合計ジャッジ時間 16,124 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
71,480 KB
testcase_01 AC 81 ms
71,188 KB
testcase_02 AC 82 ms
71,408 KB
testcase_03 AC 79 ms
71,296 KB
testcase_04 AC 80 ms
71,308 KB
testcase_05 AC 79 ms
71,472 KB
testcase_06 AC 81 ms
71,012 KB
testcase_07 AC 83 ms
71,484 KB
testcase_08 AC 81 ms
71,428 KB
testcase_09 AC 80 ms
71,516 KB
testcase_10 AC 82 ms
71,244 KB
testcase_11 AC 82 ms
71,376 KB
testcase_12 AC 82 ms
71,384 KB
testcase_13 AC 85 ms
71,384 KB
testcase_14 AC 83 ms
71,244 KB
testcase_15 AC 85 ms
71,236 KB
testcase_16 AC 85 ms
71,380 KB
testcase_17 AC 83 ms
71,412 KB
testcase_18 AC 83 ms
71,312 KB
testcase_19 AC 83 ms
71,240 KB
testcase_20 AC 82 ms
71,184 KB
testcase_21 AC 81 ms
71,300 KB
testcase_22 AC 81 ms
71,512 KB
testcase_23 AC 82 ms
71,408 KB
testcase_24 AC 80 ms
71,244 KB
testcase_25 AC 81 ms
71,292 KB
testcase_26 AC 82 ms
71,276 KB
testcase_27 AC 80 ms
71,184 KB
testcase_28 AC 81 ms
71,236 KB
testcase_29 AC 81 ms
71,508 KB
testcase_30 AC 83 ms
71,484 KB
testcase_31 AC 83 ms
71,272 KB
testcase_32 AC 83 ms
71,408 KB
testcase_33 AC 82 ms
71,044 KB
testcase_34 AC 81 ms
71,356 KB
testcase_35 AC 81 ms
71,488 KB
testcase_36 AC 80 ms
71,228 KB
testcase_37 AC 80 ms
71,308 KB
testcase_38 AC 81 ms
71,376 KB
testcase_39 AC 81 ms
71,336 KB
testcase_40 AC 81 ms
71,496 KB
testcase_41 AC 80 ms
71,088 KB
testcase_42 AC 81 ms
71,352 KB
testcase_43 AC 81 ms
71,220 KB
testcase_44 AC 81 ms
71,296 KB
testcase_45 AC 79 ms
71,396 KB
testcase_46 AC 83 ms
71,436 KB
testcase_47 AC 81 ms
71,296 KB
testcase_48 AC 81 ms
71,372 KB
testcase_49 AC 82 ms
71,356 KB
testcase_50 AC 82 ms
71,344 KB
testcase_51 AC 81 ms
71,244 KB
testcase_52 AC 82 ms
71,352 KB
testcase_53 AC 80 ms
71,456 KB
testcase_54 AC 82 ms
71,316 KB
testcase_55 AC 82 ms
71,404 KB
testcase_56 AC 80 ms
71,196 KB
testcase_57 AC 81 ms
71,184 KB
testcase_58 AC 81 ms
71,420 KB
testcase_59 AC 102 ms
76,220 KB
testcase_60 AC 118 ms
79,700 KB
testcase_61 AC 106 ms
76,920 KB
testcase_62 AC 119 ms
78,136 KB
testcase_63 AC 122 ms
77,424 KB
testcase_64 AC 122 ms
78,208 KB
testcase_65 AC 103 ms
76,700 KB
testcase_66 AC 107 ms
77,148 KB
testcase_67 AC 124 ms
77,432 KB
testcase_68 AC 120 ms
78,216 KB
testcase_69 AC 124 ms
77,692 KB
testcase_70 AC 125 ms
78,024 KB
testcase_71 AC 125 ms
77,652 KB
testcase_72 AC 105 ms
76,968 KB
testcase_73 AC 106 ms
77,404 KB
testcase_74 AC 124 ms
77,664 KB
testcase_75 AC 121 ms
77,704 KB
testcase_76 AC 101 ms
76,580 KB
testcase_77 AC 122 ms
77,832 KB
testcase_78 AC 128 ms
78,340 KB
testcase_79 AC 105 ms
77,436 KB
testcase_80 AC 128 ms
77,744 KB
testcase_81 AC 121 ms
77,408 KB
testcase_82 AC 101 ms
76,384 KB
testcase_83 AC 104 ms
76,984 KB
testcase_84 AC 102 ms
76,456 KB
testcase_85 AC 108 ms
76,972 KB
testcase_86 AC 108 ms
77,816 KB
testcase_87 AC 104 ms
76,872 KB
testcase_88 AC 102 ms
76,396 KB
testcase_89 AC 102 ms
76,212 KB
testcase_90 AC 108 ms
77,900 KB
testcase_91 AC 124 ms
77,964 KB
testcase_92 AC 121 ms
77,208 KB
testcase_93 AC 126 ms
77,604 KB
testcase_94 AC 104 ms
76,680 KB
testcase_95 AC 106 ms
77,012 KB
testcase_96 AC 120 ms
78,856 KB
testcase_97 AC 130 ms
77,832 KB
testcase_98 AC 131 ms
78,028 KB
testcase_99 AC 103 ms
76,352 KB
testcase_100 AC 122 ms
77,640 KB
testcase_101 AC 105 ms
76,952 KB
testcase_102 AC 102 ms
76,412 KB
testcase_103 AC 108 ms
77,120 KB
testcase_104 AC 121 ms
77,124 KB
testcase_105 AC 100 ms
76,212 KB
testcase_106 AC 108 ms
76,736 KB
testcase_107 AC 105 ms
76,984 KB
testcase_108 AC 102 ms
76,440 KB
testcase_109 WA -
testcase_110 WA -
testcase_111 WA -
testcase_112 WA -
testcase_113 WA -
testcase_114 WA -
testcase_115 WA -
testcase_116 WA -
testcase_117 WA -
testcase_118 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from operator import add
k,L,R = map(int,input().split())

a = [0]*61
for i in range(1,61):
    a[i] = 2*a[i-1]+len(str(i*i))

if k > 60 or a[k] < R:
    print(-1)
    exit()

def s(k,x):
    v = 0
    for i in str(k*k)[:x]: v += int(i) if i != "0" else 10
    return v

def p(k,x):
    v = 1
    for i in str(k*k)[:x]: v *= int(i) if i != "0" else 10
    return v

def f(k,R):
    g = s if op==add else p
    if R <= 1: return max(R,0)
    if R == a[k]: return op(2*f(k-1,a[k-1]) if op==add else f(k-1,a[k-1])**2%MOD, g(k,9))
    if R <= a[k-1]: return f(k-1,R)
    v = a[k-1] + len(str(k*k))
    if R <= v: return op(f(k-1,a[k-1]), g(k,R-a[k-1]))
    else: return op(op(f(k-1,a[k-1]), g(k,9)), f(k-1,R-v))

MOD = 10**9+7
def mul(a,b): return a*b%MOD

op = add
print(f(k,R)-f(k,L-1), end=" ")
op = mul
print(f(k,R)*(pow(f(k,L-1),MOD-2,MOD) if L>1 else 1)%MOD)
0