結果
| 問題 | No.131 マンハッタン距離 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-05-23 04:11:17 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 30 ms / 5,000 ms | 
| コード長 | 324 bytes | 
| コンパイル時間 | 1,784 ms | 
| コンパイル使用メモリ | 192,456 KB | 
| 最終ジャッジ日時 | 2025-01-21 17:32:01 | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 24 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() 
{
    cin.tie(0);
    ios::sync_with_stdio(false); 
    long long int x, y, d;
    cin >> x >> y >> d;
    long long int L = d - x;
    long long int R = d;
    L = max(L, 0LL);
    R = min(R, y);
    cout << max(0LL,R - L + 1) << '\n';
    
    return 0;
}
            
            
            
        