結果

問題 No.2208 Linear Function
ユーザー irohasu19_irohasu19_
提出日時 2023-02-11 00:33:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 1,113 bytes
コンパイル時間 1,891 ms
コンパイル使用メモリ 198,464 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-22 01:15:03
合計ジャッジ時間 2,344 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h> 
#define repr(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,n) for(int i=0;i<n;i++) 
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b) 
#define reprev(i,n) reprrev(i,0,n) 
#define _GLIBCXX_DEBUG 
                     
using ll = long long; 
using ull = unsigned long long; 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } 
const ll mod = 1e9+7; 
void chmod(ll &M){ 
  if(M >= mod) M %= mod; 
  else if(M < 0){ 
     M += (abs(M)/mod + 1)*mod; 
    M %= mod; 
} 
} 
int getl(int i, int N) { return i==0? N-1:i-1; }; 
int getr(int i, int N) { return i==N-1? 0:i+1; }; 
long long GCD(long long a, long long b) { 
  if (b == 0) return a; 
  else return GCD(b, a % b); 
} 
using namespace std; 
using Graph = vector<vector<int>>;

int main() {
  int T; cin >> T;
  
  rep(i, T) {
    int l, r, a, b; cin >> l >> r >> a >> b;
    if(a>0) cout << a*r+b << endl;
    if(a<0) cout << a*l+b << endl;
    if(a==0) cout << b << endl;
    }
  }
0