結果

問題 No.2622 Dam
ユーザー GOTKAKO
提出日時 2024-02-09 21:27:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 507 bytes
コンパイル時間 1,762 ms
コンパイル使用メモリ 193,640 KB
最終ジャッジ日時 2025-02-19 03:15:42
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t; cin >> t;
    while(t--){
        long long V,X,Fo,Fi,Q,R; cin >> V >> X >> Fo >> Fi >> Q >> R;
        long long minus = Fo*Q,plus = Fi*R;

        X += -Fo*R+plus;
        if(X > V){cout << "Overflow" << endl; continue;}

        if(minus == plus) cout << "Safe" << endl;
        else if(plus > minus) cout << "Overflow" << endl;
        else cout << "Zero" << endl;
    }
}
0