結果
問題 | No.2624 Prediction by Average |
ユーザー |
|
提出日時 | 2024-02-09 21:54:38 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,267 ms / 2,000 ms |
コード長 | 845 bytes |
コンパイル時間 | 1,851 ms |
コンパイル使用メモリ | 206,100 KB |
実行使用メモリ | 232,320 KB |
最終ジャッジ日時 | 2024-09-28 15:11:15 |
合計ジャッジ時間 | 10,839 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main(){ios_base::sync_with_stdio(false);cin.tie(nullptr);vector<vector<int>> ok(100001);for(int i=1; i<=1000; i++){int limit = i*100*1000;for(long long s=0; s<=limit; s+=1000){long long now = s/i;ok.at(now).push_back(i);}}int T; cin >> T;while(T--){long long N; cin >> N;string S; cin >> S;reverse(S.begin(),S.end());long long T = 0,p10 = 1;for(auto c : S){if(c == '.') continue;T += p10*(c-'0');p10 *= 10;}long long answer = max(0LL,N-999);N = min(999LL,N);for(auto n : ok.at(T)){if(n > N) break;answer++;}cout << answer << endl;}}