結果
問題 | No.2624 Prediction by Average |
ユーザー |
|
提出日時 | 2024-02-09 21:54:38 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,410 ms / 2,000 ms |
コード長 | 845 bytes |
コンパイル時間 | 1,975 ms |
コンパイル使用メモリ | 198,300 KB |
最終ジャッジ日時 | 2025-02-19 03:36:06 |
ジャッジサーバーID (参考情報) |
judge4 / 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; } }