結果

問題 No.131 マンハッタン距離
ユーザー kyuna
提出日時 2019-08-31 16:24:58
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 289 bytes
コンパイル時間 551 ms
コンパイル使用メモリ 68,076 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-24 22:26:03
合計ジャッジ時間 1,481 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main() {
    int x, y; cin >> x >> y;
    int d; cin >> d;
    if (x + y < d) {
        cout << 0 << endl;
    } else {
        cout << d + 1 - max(0, d - x) - max(0, d - y) << endl;
    }
    return 0;
}
0