結果
| 問題 | No.131 マンハッタン距離 | 
| コンテスト | |
| ユーザー |  furu_tuww | 
| 提出日時 | 2016-07-09 23:32:10 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 283 bytes | 
| コンパイル時間 | 1,048 ms | 
| コンパイル使用メモリ | 56,180 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-13 09:43:30 | 
| 合計ジャッジ時間 | 1,651 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 24 | 
ソースコード
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
long long x,y,d;
int main(void){
  cin >> x >> y >> d;
  if(x > y) swap(x,y);
  if(d <=x) cout << d+1 << endl;
  else if(x < d && d <= y) cout << x+1 << endl;
  else cout << max(0LL,x+y-d+1) << endl;
}
            
            
            
        