結果
問題 | No.131 マンハッタン距離 |
ユーザー |
![]() |
提出日時 | 2015-07-28 06:40:45 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 281 bytes |
コンパイル時間 | 1,115 ms |
コンパイル使用メモリ | 159,436 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-16 04:33:02 |
合計ジャッジ時間 | 1,936 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int x, y, d; cin >> x >> y >> d; if (x < y) swap(x, y); if (d > x + y) cout << 0 << endl; else if (d > x) cout << x + y - d + 1 << endl; else if (d < y) cout << d + 1 << endl; else cout << y + 1 << endl; }