結果

問題 No.2208 Linear Function
ユーザー ninja-kidninja-kid
提出日時 2023-02-11 14:18:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 960 bytes
コンパイル時間 4,552 ms
コンパイル使用メモリ 259,932 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-22 11:39:02
合計ジャッジ時間 5,015 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n, m) for (int i = (int)(n); i > (int)(m); i--)
using namespace atcoder;
using ll = long long;
const ll MOD1 = 1000000007LL;
const ll MOD2 = 998244353LL;
using namespace std;
const vector<pair<int, int>> dpos4 = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
// const vector<pair<int, int>> dpos8 = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 1}, {1, -1}, {1, 0}, {1, 1}};
template <typename T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;  // aをbで更新
        return true;
    }
    return false;
}
template <typename T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;  // aをbで更新
        return true;
    }
    return false;
}


int main() {
    int T;
    cin >> T;
    rep(i, T){
        ll L, R, A, B;
        cin >> L >> R >> A >> B;
        cout << max(L * A + B, R * A + B) << endl;
    }
	return 0;
}
0