結果
| 問題 | 
                            No.2208 Linear Function
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2025-03-31 19:48:32 | 
| 言語 | C++23  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 566 bytes | 
| コンパイル時間 | 1,200 ms | 
| コンパイル使用メモリ | 104,452 KB | 
| 実行使用メモリ | 7,324 KB | 
| 最終ジャッジ日時 | 2025-03-31 19:48:34 | 
| 合計ジャッジ時間 | 1,718 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 3 | 
ソースコード
#include <iostream>
#include <cstdint>
#include <vector>
#include <cmath>
using namespace std;
static inline constexpr int32_t solve(const int32_t L, const int32_t R, const int32_t A, const int32_t B) noexcept
{
	if (signbit(A))
		return A * L + B;
	else
		return A * R + B;
}
int main()
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	
	uint32_t T, i;
	cin >> T;
	vector<int32_t> L(T), R(T), A(T), B(T);
	for (i = 0; i != T; ++i)
		cin >> L[i] >> R[i] >> A[i] >> B[i];
	for (i = 0; i != T; ++i)
		cout << solve(L[i], R[i], A[i], B[i]) << '\n';
	return 0;
}