結果

問題 No.3241 Make Multiplication of 8
ユーザー ゼット
提出日時 2025-08-23 21:35:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 271 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 82,636 KB
実行使用メモリ 76,732 KB
最終ジャッジ日時 2025-08-23 21:35:34
合計ジャッジ時間 3,906 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
result=0
x,y,z=0,0,0
for i in range(N):
  a,b=map(int,input().split())
  if a%8==0:
    x+=b
  elif a%4==0:
    y+=b
  elif a%2==0:
    z+=b
result+=x
count=min(y,z)
result+=count
y-=count
z-=count
result+=y//2
if y%2==1:
  z+=1
result+=z//3

print(result)
0