結果
問題 |
No.991 N×Mマス計算(構築)
|
ユーザー |
![]() |
提出日時 | 2025-07-09 06:26:32 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 868 bytes |
コンパイル時間 | 638 ms |
コンパイル使用メモリ | 82,156 KB |
実行使用メモリ | 81,728 KB |
最終ジャッジ日時 | 2025-07-09 06:26:39 |
合計ジャッジ時間 | 5,902 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 WA * 6 |
ソースコード
import sys input = sys.stdin.readline from random import randint X=int(input()) while True: N=randint(1,min(X*3+10,10**5)) M=randint(1,min(X*3+10,10**5)) for x in range(N+1): if x*M>X: break rest=X-x*M if rest==0: y=0 elif N-x==0: continue else: if rest%(N-x)!=0: continue else: y=rest//(N-x) #print(N,M,x,y) mas=(N-x)*(M-y) #print(mas) # mas * i == X (mod K) if mas>X: K=mas-X if K>=10**9: continue print(N,M,K) A=[K]*x+[1]*(N-x) B=[K]*y+[1]*(M-y) B=["*"]+B print(*B) for a in A: print(a) exit()