結果
| 問題 |
No.2624 Prediction by Average
|
| コンテスト | |
| ユーザー |
FromBooska
|
| 提出日時 | 2024-02-21 12:42:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 622 bytes |
| コンパイル時間 | 154 ms |
| コンパイル使用メモリ | 81,872 KB |
| 実行使用メモリ | 68,672 KB |
| 最終ジャッジ日時 | 2024-09-29 04:14:11 |
| 合計ジャッジ時間 | 1,058 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 1 WA * 4 |
ソースコード
# 公式解説より、1000を超えれば常に可能なので1000までを調べる
# 切り捨てということは+1では大きすぎるので微妙に小さくする必要ある
from math import ceil, floor
T = int(input())
for t in range(T):
N, S = map(float, input().split())
N = int(N)
S1000 = int(S*1000)
ans = max(0, N-999)
for n in range(1, min(1000, N+1)):
low = ceil((S1000*n)/1000)
high = floor(((S1000+1)*n)/1000-0.0000001)
# 微妙に小さくする
if high >= low:
ans += 1
#print('n', n, 'low', low, 'high', high)
print(ans)
FromBooska