結果

問題 No.3241 Make Multiplication of 8
ユーザー Iroha_3856
提出日時 2025-08-22 21:06:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 312 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 82,192 KB
実行使用メモリ 78,232 KB
最終ジャッジ日時 2025-08-22 21:06:53
合計ジャッジ時間 3,857 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A, B = [0]*N, [0]*N

one, two = 0, 0
ans = 0
for i in range(N):
	A[i], B[i] = map(int, input().split())
	if A[i]%8 == 0:
		ans += B[i]
	elif A[i]%4 == 0:
		two += B[i]
	elif A[i]%2 == 0:
		one += B[i]

if one >= two:
	ans += two + (one - two) // 3
else:
	ans += one + (two - one) // 2
print(ans)
0