結果

問題 No.2624 Prediction by Average
ユーザー AngrySadEight
提出日時 2024-02-02 02:04:54
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 604 bytes
コンパイル時間 678 ms
コンパイル使用メモリ 68,224 KB
最終ジャッジ日時 2025-02-19 01:03:25
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cassert>
#include <iostream>
#include <string>
using namespace std;

int main() {
    int T;
    cin >> T;
    while (T--) {
        long long N;
        cin >> N;
        string S;
        cin >> S;
        int len = S.size();
        long long score =
            stoll(S.substr(0, len - 4)) * 1000 + stoll(S.substr(len - 3, 3));
        long long ans = 0;
        for (long long i = 1; i <= min(N, 1000LL); i++){
            if ((score * i - 1) / 1000 != ((score + 1) * i- 1) / 1000){
                ans++;
            }
        }
        cout << ans + max(N - 1000LL, 0LL) << endl;
    }
}
0