結果
| 問題 |
No.2624 Prediction by Average
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-02-09 22:53:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 848 bytes |
| コンパイル時間 | 1,485 ms |
| コンパイル使用メモリ | 168,752 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-09-28 16:04:58 |
| 合計ジャッジ時間 | 1,821 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 |
ソースコード
#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;
}