結果
| 問題 | No.131 マンハッタン距離 | 
| コンテスト | |
| ユーザー |  __NCAstar | 
| 提出日時 | 2015-01-20 23:31:40 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 376 bytes | 
| コンパイル時間 | 1,685 ms | 
| コンパイル使用メモリ | 157,672 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-22 23:16:02 | 
| 合計ジャッジ時間 | 2,644 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 24 | 
ソースコード
#include<bits/stdc++.h>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
typedef long long ll;
int main(){
  ll x,y,d;
  cin >> x >> y >> d;
  if( x + y < d ) puts("0");
  else {
    ll sp[2];
    if( d >= y ) sp[0] = d - y;
    else         sp[0] = 0;
    sp[1] = min(d,x);
    cout << sp[1] - sp[0] + 1 << endl;
  }
  return 0;
}
            
            
            
        