結果
問題 | No.131 マンハッタン距離 |
ユーザー |
![]() |
提出日時 | 2023-10-28 00:57:05 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 27 ms / 5,000 ms |
コード長 | 578 bytes |
コンパイル時間 | 1,963 ms |
コンパイル使用メモリ | 192,028 KB |
最終ジャッジ日時 | 2025-02-17 16:25:56 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include <bits/stdc++.h>#include<iostream>#include<iomanip>#include<string>#include<algorithm>#include<vector>#include<set>#include<list>#include<queue>#include<math.h>#include<bitset>using ll = long long;using namespace std;int main(){int x, y, d, min1 = -1, max1 = 1e9 + 1;cin >> x >> y >> d;min1 = min(x, y);max1 = max(x, y);if (d <= min1) cout << d + 1 << endl;else if (min1 < d && d <= max1) cout << min1 + 1 << endl;else if (max1 < d && d <= max1 + min1) cout << max1 + min1 - d + 1 << endl;else cout << 0 << endl;}