結果
| 問題 |
No.2239 Friday
|
| ユーザー |
|
| 提出日時 | 2023-03-10 21:26:52 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 309 bytes |
| コンパイル時間 | 2,041 ms |
| コンパイル使用メモリ | 191,664 KB |
| 最終ジャッジ日時 | 2025-02-11 07:39:51 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d%d", &a, &b);
| ~~~~~^~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a, b;
scanf("%d%d", &a, &b);
int ans = a + b;
for (int i = 1; i <= min(a, b); i++)
{
int x = a + b - i * 2;
int y = i * 2;
ans = min(ans, abs(x - y));
}
printf("%d\n", ans);
return 0;
}