結果
| 問題 | No.131 マンハッタン距離 |
| コンテスト | |
| ユーザー |
maine_honzuki
|
| 提出日時 | 2020-05-19 09:07:20 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 329 bytes |
| 記録 | |
| コンパイル時間 | 1,581 ms |
| コンパイル使用メモリ | 165,184 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-01 22:33:06 |
| 合計ジャッジ時間 | 2,739 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / 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);
int ans;
if (d <= x)
ans = d + 1;
else if (d > x + y)
ans = 0;
else if (d <= y)
ans = x + 1;
else
ans = x + y - d + 1;
cout << ans << endl;
}
maine_honzuki