結果
問題 | No.2110 012 Matching |
ユーザー |
![]() |
提出日時 | 2022-10-28 21:30:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 66 ms / 2,000 ms |
コード長 | 427 bytes |
コンパイル時間 | 1,874 ms |
コンパイル使用メモリ | 192,444 KB |
最終ジャッジ日時 | 2025-02-08 14:06:36 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 11 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%d", &T); | ~~~~~^~~~~~~~~~ main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%lld%lld%lld", &A, &B, &C); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> int main() { int T; long long A, B, C; scanf("%d", &T); while (T--) { scanf("%lld%lld%lld", &A, &B, &C); long long ans = 0, t = 0; t = B / 2; ans += 2 * t; B = B - 2 * t; t = std::min(A, C); ans += 2 * t; A -= t; C -= t; t = std::min(A, B); ans += t; A -= t; B -= t; t = C / 2; ans += t; C = C - 2 * t; printf("%lld\n", ans); } }