結果

問題 No.3245 Payment with 8-rep Currency
ユーザー ゼット
提出日時 2025-08-24 00:29:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 334 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 82,180 KB
実行使用メモリ 78,400 KB
最終ジャッジ日時 2025-08-24 00:30:06
合計ジャッジ時間 13,622 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 25 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

Q=int(input())
for _ in range(Q):
  N=int(input())
  if N%8!=0:
    print(-1)
    continue
  N//=8
  d=(1+11+111+1111)
  K=N//d
  x,y,z,w=K,K,K,K
  rest=N-d*K
  u=rest//1111
  rest-=1111*u
  v=rest//111
  rest-=111*v
  p=rest//11
  rest-=11*p
  w+=u
  z+=v
  y+=p
  x+=rest
  S=(x+y+z+w)
  if x>S//2:
    print(-1)
  print(x,y,z,w)
  
0