結果

問題 No.2208 Linear Function
ユーザー CoCo_Japan_panCoCo_Japan_pan
提出日時 2023-02-10 21:29:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 671 bytes
コンパイル時間 1,972 ms
コンパイル使用メモリ 196,596 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-21 22:32:58
合計ジャッジ時間 2,548 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define overload3(_1, _2, _3, name, ...) name
#define rep1(n) for(ll _ = 0; _ < (n); ++_)
#define rep2(i, n) for(ll i = 0; i < (n); ++i)
#define rep3(i, a, b) for(ll i = (a); i < (b); ++i)
#define rep(...) overload3(__VA_ARGS__, rep3, rep2, rep1)(__VA_ARGS__)

#define all(x) (x).begin(), (x).end()
template <class T> using vec = vector<T>;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int T;
    cin >> T;
    rep(T){
        int L, R, A, B;
        cin >> L >> R >> A >> B;
        if(A >= 0) cout << R * A + B << "\n";
        else cout << L * A + B << "\n";
    }
}
0