結果
| 問題 |
No.2624 Prediction by Average
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-02-09 22:16:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 864 bytes |
| コンパイル時間 | 2,468 ms |
| コンパイル使用メモリ | 212,272 KB |
| 最終ジャッジ日時 | 2025-02-19 03:47:22 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 |
ソースコード
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
return (ull)rng() % B;
}
inline double time() {
return static_cast<long double>(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count()) * 1e-9;
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int q; cin >> q;
while (q--) {
ll n; cin >> n;
string str; cin >> str;
ll u = stoi(str.substr(str.size()-3));
ll res = max(0LL, n-1000);
for (ll i = 1; i <= min(n, 1000LL); ++i) {
if ((u*i+999)/1000 <= ((u+1)*i-1)/1000) {
res += 1;
}
}
cout << res << "\n";
}
}