結果

問題 No.2624 Prediction by Average
ユーザー titiatitia
提出日時 2024-02-09 23:17:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,137 ms / 2,000 ms
コード長 400 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 81,828 KB
実行使用メモリ 71,068 KB
最終ジャッジ日時 2024-02-09 23:18:03
合計ジャッジ時間 3,681 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
57,684 KB
testcase_01 AC 88 ms
66,908 KB
testcase_02 AC 1,137 ms
66,896 KB
testcase_03 AC 36 ms
53,716 KB
testcase_04 AC 825 ms
71,036 KB
testcase_05 AC 829 ms
71,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

eps=10**(-12)

T=int(input())
for tests in range(T):
    N,S=input().split()
    N=int(N)
    x=S.index(".")
    S=int(S[x+1:])

    ANS=0

    for i in range(1,min(N,15000)+1):
        if (S*i)%1000==0:
            ANS+=1
        else:
            if (S*i)//1000!=(S+1-eps)*i//1000:
                ANS+=1

    if N>15000:
        ANS+=N-15000

    print(ANS)
0