結果
問題 |
No.131 マンハッタン距離
|
ユーザー |
![]() |
提出日時 | 2023-10-28 00:55:01 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 574 bytes |
コンパイル時間 | 1,745 ms |
コンパイル使用メモリ | 192,848 KB |
最終ジャッジ日時 | 2025-02-17 16:25:48 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 WA * 7 |
ソースコード
#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 << endl; else cout << 0 << endl; }