結果

問題 No.2208 Linear Function
ユーザー nono00nono00
提出日時 2023-02-10 23:09:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 564 bytes
コンパイル時間 1,866 ms
コンパイル使用メモリ 196,396 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-22 00:15:07
合計ジャッジ時間 2,448 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, l, r) for (int i = (int)(l); i < (int)(r); i++)
#define rrep(i, r, l) for (int i = (int)(r); i > (int)(l); i--)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()


void solve() {
    int l, r, a, b;
    cin >> l >> r >> a >> b;
    if (a == 0) {
        cout << b << '\n';
    } else if (a > 0) {
        cout << (a * r + b) << '\n';
    } else {
        cout << (a * l + b) << '\n';
    }
}

int main() {
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
}
0