結果

問題 No.219 巨大数の概算
ユーザー kohei2019kohei2019
提出日時 2022-01-05 19:38:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 249 ms / 1,500 ms
コード長 773 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 80,896 KB
最終ジャッジ日時 2024-04-24 00:05:54
合計ジャッジ時間 13,383 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 233 ms
79,872 KB
testcase_01 AC 215 ms
79,872 KB
testcase_02 AC 213 ms
79,360 KB
testcase_03 AC 231 ms
79,872 KB
testcase_04 AC 249 ms
79,488 KB
testcase_05 AC 37 ms
52,096 KB
testcase_06 AC 120 ms
76,672 KB
testcase_07 AC 36 ms
51,712 KB
testcase_08 AC 114 ms
76,672 KB
testcase_09 AC 37 ms
51,968 KB
testcase_10 AC 229 ms
79,872 KB
testcase_11 AC 214 ms
79,616 KB
testcase_12 AC 218 ms
80,384 KB
testcase_13 AC 213 ms
79,744 KB
testcase_14 AC 221 ms
79,488 KB
testcase_15 AC 220 ms
80,384 KB
testcase_16 AC 220 ms
80,256 KB
testcase_17 AC 226 ms
80,128 KB
testcase_18 AC 218 ms
80,000 KB
testcase_19 AC 218 ms
80,128 KB
testcase_20 AC 215 ms
79,360 KB
testcase_21 AC 216 ms
79,744 KB
testcase_22 AC 219 ms
79,488 KB
testcase_23 AC 242 ms
80,384 KB
testcase_24 AC 219 ms
80,128 KB
testcase_25 AC 212 ms
79,232 KB
testcase_26 AC 213 ms
80,128 KB
testcase_27 AC 218 ms
80,512 KB
testcase_28 AC 214 ms
80,896 KB
testcase_29 AC 226 ms
80,256 KB
testcase_30 AC 222 ms
80,000 KB
testcase_31 AC 217 ms
79,488 KB
testcase_32 AC 225 ms
79,488 KB
testcase_33 AC 200 ms
79,104 KB
testcase_34 AC 204 ms
78,976 KB
testcase_35 AC 224 ms
79,744 KB
testcase_36 AC 214 ms
79,360 KB
testcase_37 AC 216 ms
79,488 KB
testcase_38 AC 226 ms
79,744 KB
testcase_39 AC 211 ms
79,360 KB
testcase_40 AC 227 ms
80,640 KB
testcase_41 AC 229 ms
80,128 KB
testcase_42 AC 204 ms
78,976 KB
testcase_43 AC 220 ms
80,256 KB
testcase_44 AC 204 ms
78,976 KB
testcase_45 AC 211 ms
79,872 KB
testcase_46 AC 207 ms
79,616 KB
testcase_47 AC 224 ms
79,872 KB
testcase_48 AC 220 ms
79,488 KB
testcase_49 AC 232 ms
80,384 KB
testcase_50 AC 220 ms
80,000 KB
testcase_51 AC 38 ms
52,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
lsAB = [list(map(int,input().split())) for i in range(N)]
def Pow10(a,n):#繰り返し二乗法
    if n==0:
        return 1,0
    if n==1:
        j = 0
        while a >= 10**j:
            j += 1
        j -= 1
        a /= 10**j
        return a,j
    if n & 1:
        ab,c = Pow10(a,n-1)
        j = 0
        while a >= 10**j:
            j += 1
        j -= 1
        a /= 10**j
        b = a*ab
        jb = 0
        while b >= 10**jb:
            jb += 1
        jb -= 1
        b /= 10**jb
        return b,c+j+jb
    a,c = Pow10(a,n>>1)
    b = a*a
    j = 0
    while b >= 10**j:
        j += 1
    j -= 1
    b /= 10**j
    return b,c+c+j

for i in range(N):
    a,b = Pow10(lsAB[i][0],lsAB[i][1])
    sa = str(a)
    print(sa[0],sa[2],b)

0