結果
問題 |
No.3241 Make Multiplication of 8
|
ユーザー |
|
提出日時 | 2025-08-22 21:03:38 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 24 ms / 2,000 ms |
コード長 | 579 bytes |
コンパイル時間 | 1,884 ms |
コンパイル使用メモリ | 194,868 KB |
実行使用メモリ | 7,720 KB |
最終ジャッジ日時 | 2025-08-22 21:03:42 |
合計ジャッジ時間 | 3,540 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; long long one = 0,two = 0,three = 0; while(N--){ int a,b; cin >> a >> b; int c = 0; while(a%2 == 0) a /= 2,c++; c = min(c,3); if(c == 1) one += b; if(c == 2) two += b; if(c == 3) three += b; } long long answer = three; long long v = min(one,two); answer += v; one -= v,two -= v; answer += one/3; answer += two/2; cout << answer << endl; }