結果

問題 No.2624 Prediction by Average
ユーザー 寝癖寝癖
提出日時 2024-02-09 23:43:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 366 bytes
コンパイル時間 551 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 71,196 KB
最終ジャッジ日時 2024-02-09 23:43:48
合計ジャッジ時間 1,323 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
60,124 KB
testcase_01 AC 81 ms
67,068 KB
testcase_02 AC 99 ms
67,068 KB
testcase_03 AC 38 ms
53,588 KB
testcase_04 AC 113 ms
71,196 KB
testcase_05 AC 107 ms
71,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import floor, ceil

T = int(input())
for _ in range(T):
    N, S = input().split()
    N = int(N)
    S1000= int(S.replace('.', ''))

    ans = 0
    for k in range(1, min(N+1, 1000)):
        l = ceil(S1000 * k / 1000)
        r = floor((S1000+1) * k / 1000 - 1e-9)
        if l <= r:
            ans += 1
    ans += len(range(1000, N+1))

    print(ans)
0