結果

問題 No.131 マンハッタン距離
ユーザー temp
提出日時 2015-02-16 09:00:01
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 507 bytes
コンパイル時間 595 ms
コンパイル使用メモリ 70,600 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-23 20:39:47
合計ジャッジ時間 1,470 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <functional>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <string>

using namespace std;

int main() {
  int x, y, d;
  cin >> x >> y >> d;
  if (x > y) swap(x, y);
  if (x+y < d) {
    std::cout << 0 << std::endl;
  }else if (d < x){
    std::cout << d+1 << std::endl;
  }else {
    std::cout << min(x+y-d+1, x+1) << std::endl;
  }
}
0