結果

問題 No.2624 Prediction by Average
ユーザー AngrySadEightAngrySadEight
提出日時 2024-02-02 02:04:54
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 604 bytes
コンパイル時間 799 ms
コンパイル使用メモリ 70,088 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-02 02:04:57
合計ジャッジ時間 1,630 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 5 ms
6,676 KB
testcase_02 AC 7 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 6 ms
6,676 KB
testcase_05 AC 6 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

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