結果

問題 No.799 赤黒かーどげぇむ
ユーザー diohabara
提出日時 2019-03-18 20:06:24
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 455 bytes
コンパイル時間 1,488 ms
コンパイル使用メモリ 165,660 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-18 23:31:36
合計ジャッジ時間 1,957 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ll long long
#define endl '\n'
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    ll ans = 0;
    for (int i = a; i <= b; i++) {
        if (c <= i && i <= d) {
            ans += d - c;
        } else {
            ans += d - c + 1;
        }
    }
    cout << ans << endl;
    return 0;
}
0