結果
問題 | No.2624 Prediction by Average |
ユーザー |
👑 ![]() |
提出日時 | 2023-12-29 11:10:01 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 1,186 bytes |
コンパイル時間 | 672 ms |
コンパイル使用メモリ | 69,236 KB |
最終ジャッジ日時 | 2025-02-18 15:08:29 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 |
ソースコード
#include <cassert>#include <iostream>#include <string>using namespace std;int main() {int T;cin >> T;assert(T >= 1);assert(T <= 1000);while (T--) {long long N;cin >> N;assert(N >= 1);assert(N <= 10000000000000);string S;cin >> S;int len = S.size();long long score =stoll(S.substr(0, len - 4)) * 1000 + stoll(S.substr(len - 3, 3));assert(score >= 0 && score <= 100000);if (N <= 1000) {long long ans = 0;for (int i = 1; i <= N; i++) {long long lb = score * i;long long ub = (score + 1) * i - 1;if ((lb - 1) / 1000 != ub / 1000) {ans++;}}cout << ans << endl;} else {long long ans = N - 1000;for (int i = 1; i <= 1000; i++) {long long lb = score * i;long long ub = (score + 1) * i - 1;if ((lb - 1) / 1000 != ub / 1000) {ans++;}}cout << ans << endl;}}}