結果
| 問題 | No.131 マンハッタン距離 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-01-21 17:43:35 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 284 bytes |
| 記録 | |
| コンパイル時間 | 553 ms |
| コンパイル使用メモリ | 53,848 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-22 23:31:24 |
| 合計ジャッジ時間 | 1,250 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
#include <iostream>
#include <cstdio>
using namespace std;
int main() {
int x, y, d;
cin >> x >> y >> d;
int ans;
if (x + y < d) {
ans = 0;
} else {
ans = d + 1;
if (x < d) {
ans -= d - x;
}
if (y < d) {
ans -= d - y;
}
}
cout << ans << endl;
return 0;
}