結果
| 問題 |
No.2624 Prediction by Average
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-02-09 22:50:48 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 501 bytes |
| コンパイル時間 | 1,921 ms |
| コンパイル使用メモリ | 193,664 KB |
| 最終ジャッジ日時 | 2025-02-19 04:00:07 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void solve();
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int test_case;
cin>>test_case;
while (test_case--){
solve();
}
}
void solve(){
ll N;
string S;
cin>>N>>S;
ll C=0;
for(int i=(int)S.size()-3;i<(int)S.size();i++){
C=C*10+(S[i]-'0');
}
C=(1000-C)%1000;
ll ans=max(0ll,N-1000);
for(int i=1;i<=min(N,1000ll);i++){
if(C*i%1000<i){
ans+=1;
}
}
cout<<ans<<'\n';
}