結果
| 問題 | No.131 マンハッタン距離 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-07-27 09:20:13 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 349 bytes | 
| コンパイル時間 | 644 ms | 
| コンパイル使用メモリ | 54,136 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-06 17:54:29 | 
| 合計ジャッジ時間 | 1,455 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 24 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:21:9: warning: ‘a’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   21 |   cout<<a<<endl;
      |         ^
            
            ソースコード
#include <iostream>
using namespace std;
int main(){
  int x,y,d,a;
  cin>>x>>y>>d;
  if(x+y<d){
    a=0;
  } else if(x+y==d){
    a=1;
  } else {
    if(x>=d && y>=d){
      a=d+1;
    } else if(x<d && y>=d){
      a=x+1;
    } else if(x>=d && y<d){
      a=y+1;
    } else if(x<d && y<d){
      a=x+y-d+1;
    }
  }
  cout<<a<<endl;
  return 0;
}
            
            
            
        