結果

問題 No.2208 Linear Function
ユーザー ただのガゼス(MonAgent)ただのガゼス(MonAgent)
提出日時 2024-02-15 01:36:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 315 bytes
コンパイル時間 608 ms
コンパイル使用メモリ 63,420 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-15 01:36:31
合計ジャッジ時間 1,466 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
using namespace std;

int main(void){
	int T, L, R, A, B;
	int ans = 0;
	cin >> T;
	
	for (int i = 0; i < T; ++i){
		ans = 0;
		cin >> L >> R >> A >> B;
		if (A > 0){
			ans = A * R + B;
		}else if (A < 0){
			ans = A * L + B;
		}else{
			ans = B;
		}
		
		cout << ans << endl;
	}
	
	return 0;
}
0