結果
| 問題 | No.131 マンハッタン距離 |
| コンテスト | |
| ユーザー |
misora192
|
| 提出日時 | 2020-05-27 22:44:16 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 577 bytes |
| 記録 | |
| コンパイル時間 | 1,370 ms |
| コンパイル使用メモリ | 167,028 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-13 03:53:24 |
| 合計ジャッジ時間 | 2,259 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
ll 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{
cout << max(x + y - d + 1, 0ll) << endl;
}
}
misora192