結果
問題 |
No.3241 Make Multiplication of 8
|
ユーザー |
![]() |
提出日時 | 2025-08-22 21:24:11 |
言語 | C (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 547 bytes |
コンパイル時間 | 301 ms |
コンパイル使用メモリ | 27,080 KB |
実行使用メモリ | 7,720 KB |
最終ジャッジ日時 | 2025-08-22 21:24:15 |
合計ジャッジ時間 | 3,866 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 7 RE * 16 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%lld", &n); | ^~~~~~~~~~~~~~~~~ main.c:9:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%lld %lld", &a[i], &b[i]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> long long int a[100005], b[100005]; int main() { long long int n; scanf("%lld", &n); long long int i; for (i = 0; i < n; i++) scanf("%lld %lld", &a[i], &b[i]); long long int ans = 0, cnt[3] = { 0,0,0 }, v; for (i = 0; i < n; i++) { for (v = 0; a[i] % 2 == 0; a[i] /= 2, v++); if (v > 2) ans += b[i]; cnt[v] += b[i]; } if (cnt[1] > cnt[2]) { ans += cnt[2]; cnt[1] -= cnt[2]; ans += cnt[1] / 3; } else { ans += cnt[1]; cnt[2] -= cnt[1]; ans += cnt[2] / 2; } printf("%lld\n", ans); return 0; }