結果

問題 No.2208 Linear Function
ユーザー achapiachapi
提出日時 2023-02-11 00:15:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 873 bytes
コンパイル時間 5,556 ms
コンパイル使用メモリ 260,224 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-09-22 00:56:01
合計ジャッジ時間 6,136 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
//using mint = modint998244353;
//using mint = modint1000000007;
#define all(...) std::begin(__VA_ARGS__), std::end(__VA_ARGS__)
#define rall(...) std::rbegin(__VA_ARGS__), std::rend(__VA_ARGS__)
#define debug(x) cerr << "\033[33m(line:" << __LINE__ << ") " << #x << ": " << x << "\033[m" << endl;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
void solve(){
	int l,r,a,b;cin>>l>>r>>a>>b;
	int ans=-inf;
	for(int i=l;i<=r;i++){
		chmax(ans,a*i+b);
	}
	cout<<ans<<endl;
}
int main() {
	int t;cin>>t;
	while(t--)solve();
}
0