結果

問題 No.493 とても長い数列と文字列(Long Long Sequence and a String)
ユーザー convexineqconvexineq
提出日時 2021-02-09 07:55:23
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 862 bytes
コンパイル時間 1,032 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 79,704 KB
最終ジャッジ日時 2023-09-20 18:32:50
合計ジャッジ時間 15,400 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,504 KB
testcase_01 AC 75 ms
71,256 KB
testcase_02 AC 76 ms
71,168 KB
testcase_03 AC 76 ms
71,368 KB
testcase_04 AC 79 ms
71,320 KB
testcase_05 AC 77 ms
71,256 KB
testcase_06 AC 76 ms
71,276 KB
testcase_07 AC 78 ms
71,352 KB
testcase_08 AC 77 ms
71,256 KB
testcase_09 AC 77 ms
71,472 KB
testcase_10 AC 77 ms
71,360 KB
testcase_11 AC 77 ms
71,496 KB
testcase_12 AC 76 ms
71,168 KB
testcase_13 AC 77 ms
71,280 KB
testcase_14 AC 76 ms
71,456 KB
testcase_15 AC 77 ms
71,464 KB
testcase_16 AC 77 ms
71,524 KB
testcase_17 AC 76 ms
71,252 KB
testcase_18 AC 77 ms
71,556 KB
testcase_19 AC 77 ms
71,496 KB
testcase_20 AC 77 ms
71,572 KB
testcase_21 AC 76 ms
71,360 KB
testcase_22 AC 77 ms
71,632 KB
testcase_23 AC 77 ms
71,180 KB
testcase_24 AC 78 ms
71,280 KB
testcase_25 AC 77 ms
71,280 KB
testcase_26 AC 77 ms
71,276 KB
testcase_27 AC 77 ms
71,168 KB
testcase_28 AC 77 ms
71,232 KB
testcase_29 AC 77 ms
71,132 KB
testcase_30 AC 78 ms
71,452 KB
testcase_31 AC 76 ms
71,364 KB
testcase_32 AC 76 ms
71,580 KB
testcase_33 AC 76 ms
71,360 KB
testcase_34 AC 78 ms
71,288 KB
testcase_35 AC 77 ms
71,640 KB
testcase_36 AC 78 ms
71,108 KB
testcase_37 AC 78 ms
71,132 KB
testcase_38 AC 78 ms
71,560 KB
testcase_39 AC 77 ms
71,624 KB
testcase_40 AC 79 ms
71,276 KB
testcase_41 AC 78 ms
71,552 KB
testcase_42 AC 78 ms
71,612 KB
testcase_43 AC 78 ms
71,384 KB
testcase_44 AC 77 ms
71,316 KB
testcase_45 AC 76 ms
71,644 KB
testcase_46 AC 76 ms
71,620 KB
testcase_47 AC 77 ms
71,460 KB
testcase_48 AC 80 ms
71,492 KB
testcase_49 AC 82 ms
71,460 KB
testcase_50 AC 77 ms
71,272 KB
testcase_51 AC 77 ms
71,252 KB
testcase_52 AC 75 ms
71,508 KB
testcase_53 AC 76 ms
71,136 KB
testcase_54 AC 77 ms
71,596 KB
testcase_55 AC 76 ms
71,136 KB
testcase_56 AC 76 ms
71,592 KB
testcase_57 AC 76 ms
71,380 KB
testcase_58 AC 76 ms
71,412 KB
testcase_59 AC 97 ms
76,544 KB
testcase_60 AC 110 ms
79,704 KB
testcase_61 AC 99 ms
77,260 KB
testcase_62 AC 111 ms
78,304 KB
testcase_63 AC 118 ms
77,840 KB
testcase_64 AC 115 ms
78,512 KB
testcase_65 AC 98 ms
76,568 KB
testcase_66 AC 103 ms
77,488 KB
testcase_67 AC 117 ms
77,580 KB
testcase_68 AC 112 ms
78,412 KB
testcase_69 AC 117 ms
77,880 KB
testcase_70 AC 117 ms
78,284 KB
testcase_71 AC 121 ms
77,788 KB
testcase_72 AC 100 ms
77,108 KB
testcase_73 AC 100 ms
77,360 KB
testcase_74 AC 116 ms
77,620 KB
testcase_75 AC 115 ms
77,848 KB
testcase_76 AC 93 ms
76,560 KB
testcase_77 AC 117 ms
78,004 KB
testcase_78 AC 126 ms
78,592 KB
testcase_79 AC 98 ms
77,216 KB
testcase_80 AC 118 ms
78,012 KB
testcase_81 AC 114 ms
77,824 KB
testcase_82 AC 96 ms
76,552 KB
testcase_83 AC 98 ms
77,316 KB
testcase_84 AC 96 ms
76,568 KB
testcase_85 AC 98 ms
77,184 KB
testcase_86 AC 105 ms
78,276 KB
testcase_87 AC 99 ms
77,040 KB
testcase_88 AC 98 ms
76,456 KB
testcase_89 AC 97 ms
76,556 KB
testcase_90 AC 105 ms
78,184 KB
testcase_91 AC 116 ms
78,104 KB
testcase_92 AC 113 ms
77,604 KB
testcase_93 AC 117 ms
77,492 KB
testcase_94 AC 97 ms
76,460 KB
testcase_95 AC 99 ms
77,116 KB
testcase_96 AC 112 ms
78,888 KB
testcase_97 AC 124 ms
78,024 KB
testcase_98 AC 123 ms
78,032 KB
testcase_99 AC 95 ms
76,500 KB
testcase_100 AC 116 ms
77,700 KB
testcase_101 AC 99 ms
77,196 KB
testcase_102 AC 94 ms
76,664 KB
testcase_103 AC 99 ms
77,432 KB
testcase_104 AC 114 ms
77,644 KB
testcase_105 AC 96 ms
76,496 KB
testcase_106 AC 99 ms
77,256 KB
testcase_107 AC 99 ms
77,176 KB
testcase_108 AC 98 ms
76,528 KB
testcase_109 RE -
testcase_110 RE -
testcase_111 RE -
testcase_112 RE -
testcase_113 RE -
testcase_114 RE -
testcase_115 RE -
testcase_116 RE -
testcase_117 RE -
testcase_118 RE -
権限があれば一括ダウンロードができます

ソースコード

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 and 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