結果
問題 | No.2622 Dam |
ユーザー |
👑 |
提出日時 | 2024-02-09 21:28:08 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 577 bytes |
コンパイル時間 | 193 ms |
コンパイル使用メモリ | 29,184 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-28 13:54:14 |
合計ジャッジ時間 | 604 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 |
ソースコード
#include <stdio.h> int solve(long long V, long long X, int Fo, int Fi, int Q, int R) { long long Y = X; Y += (long long)(Fi - Fo) * R; if (Y > V) return 1; Y -= (long long)Fo * (Q - R); if (Y < X) return -1; else if (Y > X) return 1; else return 0; } int main() { int T, Fo, Fi, Q, R, ans; long long V, X; scanf("%d", &T); while (T--) { scanf("%lld %lld %d %d %d %d", &V, &X, &Fo, &Fi, &Q, &R); ans = solve(V, X, Fo, Fi, Q, R); if (ans < 0) printf("Zero\n"); else if (ans > 0) printf("Overflow\n"); else printf("Safe\n"); } fflush(stdout); return 0; }