結果
問題 | No.2189 六平方和 |
ユーザー | titia |
提出日時 | 2023-01-13 22:20:30 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 41 ms / 2,000 ms |
コード長 | 472 bytes |
コンパイル時間 | 93 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 11,264 KB |
最終ジャッジ日時 | 2024-12-24 17:58:35 |
合計ジャッジ時間 | 2,502 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
from math import sqrt from random import randint N,M,mod=map(int,input().split()) A=pow(M,N,mod) iniA=A while True: ANS=[] ANS=[randint(1,10**9)] A=iniA-ANS[-1]**2 A%=mod while A>0: k=int(sqrt(A)) if k==0: ANS.append(mod) else: ANS.append(k) A-=k*k A%=mod while len(ANS)<6: ANS.append(mod) if len(ANS)==6: print("YES") print(*ANS) break