結果
問題 |
No.3245 Payment with 8-rep Currency
|
ユーザー |
![]() |
提出日時 | 2025-08-24 00:42:41 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 679 bytes |
コンパイル時間 | 432 ms |
コンパイル使用メモリ | 82,312 KB |
実行使用メモリ | 78,112 KB |
最終ジャッジ日時 | 2025-08-24 00:42:46 |
合計ジャッジ時間 | 5,078 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 1 |
other | WA * 1 RE * 29 |
ソースコード
Q=int(input()) for _ in range(Q): N=int(input()) if N%8!=0: print(-1) continue N//=8 if N>2460: p=[1] print(p[1]) x,y,z,w=N//123,N//123,N//123,0 rest=N-123*(N//123) z+=rest//111 rest-=111*(rest//111) y+=rest//11 rest-=11*(rest//11) x+=rest print(x,y,z,w) continue x,y,z,w=-1,-1,-1,-1 for a in range(22): if x>=0: break if 111*a>N: break for b in range(222): if 111*a+11*b>N: break z2=a y2=b x2=N-(111*a+11*b) S=(x2+y2+z2)//2 if x2<=S and y2<=S and z2<=S: x,y,z,w=x2,y2,z2,0 break if x>=0: print(x,y,z,w) else: print(-1)