結果

問題 No.2622 Dam
ユーザー pesefootball konamipesefootball konami
提出日時 2024-02-09 21:28:24
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 956 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 65,932 KB
最終ジャッジ日時 2024-02-09 21:28:28
合計ジャッジ時間 3,676 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# Function to simulate the water flow and check if the dam overflows or runs out
def check_dam(V, X, Fo, Fi, Q, R):
    t = 0
    water_level = X

    while True:
        # Check if the dam overflows
        if water_level > V:
            return "Overflow"
        
        # Check if the dam runs out of water
        if water_level <= 0:
            return "Zero"
        
        # Simulate water outflow
        water_level -= Fo
        
        # Check if there's a rainfall event
        if t % Q == 0:
            water_level += Fi
        
        # Increment time
        t += 1

# Read the number of test cases
T = int(input())

# Iterate over each test case
for _ in range(T):
    # Read input parameters for the test case
    V, X, Fo, Fi, Q, R = map(int, input().split())
    
    # Call the function to check the dam status for the current test case
    result = check_dam(V, X, Fo, Fi, Q, R)
    
    # Output the result
    print(result)
0