結果

問題 No.251 大きな桁の復習問題(1)
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-07-30 14:32:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 684 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 76,288 KB
最終ジャッジ日時 2024-04-17 15:41:08
合計ジャッジ時間 2,569 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
55,424 KB
testcase_01 AC 55 ms
55,296 KB
testcase_02 AC 50 ms
55,296 KB
testcase_03 AC 51 ms
55,040 KB
testcase_04 WA -
testcase_05 AC 50 ms
55,424 KB
testcase_06 AC 50 ms
55,168 KB
testcase_07 AC 50 ms
55,296 KB
testcase_08 AC 51 ms
55,296 KB
testcase_09 AC 77 ms
75,904 KB
testcase_10 AC 80 ms
76,288 KB
testcase_11 AC 79 ms
76,288 KB
testcase_12 AC 82 ms
76,288 KB
testcase_13 AC 79 ms
75,776 KB
testcase_14 AC 77 ms
76,032 KB
testcase_15 AC 77 ms
76,160 KB
testcase_16 AC 77 ms
76,032 KB
testcase_17 AC 79 ms
76,032 KB
testcase_18 AC 79 ms
75,776 KB
testcase_19 AC 80 ms
76,288 KB
testcase_20 AC 51 ms
55,296 KB
testcase_21 AC 53 ms
55,168 KB
testcase_22 AC 52 ms
55,296 KB
testcase_23 AC 52 ms
55,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import pypyjit
# pypyjit.set_param('max_unroll_recursion=-1')
from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline

N = list(input())[:-1]
M = list(input())[:-1]
N = [int(i) for i in N]
M = [int(i) for i in M]
mod = 129402307

def f(X,m):
    n = len(X)
    I = 1
    now = 0
    for i in range(n-1,-1,-1):
        now += X[i]*I
        now %= m
        I *= 10
        I %= m
    return now
    
    
m = f(M,mod-1)
n = f(N,mod)
if N == [0]:
    print(0)
    exit()
if n==0:
    if m==0:
        print(1)
    else:
        print(0)
    exit()
if m==0:
    print(1)
    exit()
print(pow(n,m,mod))

0