結果

問題 No.2624 Prediction by Average
ユーザー maksimmaksim
提出日時 2024-02-09 22:53:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 848 bytes
コンパイル時間 1,596 ms
コンパイル使用メモリ 168,432 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-09 22:53:58
合計ジャッジ時間 2,015 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
#define int long long
#define all(x) x.begin(), x.end()
#define app push_back
#ifdef LOCAL
#define debug(...) [](auto...a){ ((cout << a << ' '), ...) << '\n';}(#__VA_ARGS__, ":", __VA_ARGS__)
#else
#define debug(...)
#endif
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t;cin>>t;
    while(t--)
    {
        int n;string s;cin>>n>>s;
        s.erase(find(all(s),'.'));int s1=stoi(s);
        int res=0;
        for(int i=1;i<=1000 && i<=n;++i)
        {
            int low=s1*i;
            int up=(s1+1)*i;
            //debug(low,up);
            bool ok=0;
            if((up-1)/1000>(low-1)/1000)
            {
                ok=1;
            }
            res+=ok;
        }
        res+=max(0LL,n-1000);
        cout<<res<<'\n';
    }
    return 0;
}
0