結果
問題 | No.131 マンハッタン距離 |
ユーザー |
![]() |
提出日時 | 2020-09-16 15:50:06 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 5,000 ms |
コード長 | 290 bytes |
コンパイル時間 | 959 ms |
コンパイル使用メモリ | 65,408 KB |
最終ジャッジ日時 | 2025-01-14 15:14:24 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include <iostream>using namespace std;int main(){int x, y, d;cin >> x >> y >> d;if (d <= min(x, y)){cout << d + 1 << endl;} else if (d <= max(x, y)){cout << min(x, y) + 1 << endl;} else if (d <= x + y){cout << x + y + 1 - d << endl;} else {cout << 0 << endl;}}