結果
| 問題 | No.2624 Prediction by Average |
| コンテスト | |
| ユーザー |
ragna
|
| 提出日時 | 2024-02-09 22:16:48 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 973 bytes |
| 記録 | |
| コンパイル時間 | 4,085 ms |
| コンパイル使用メモリ | 251,036 KB |
| 最終ジャッジ日時 | 2025-02-19 03:47:38 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 1 WA * 4 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace atcoder;
using mint=modint998244353;
using namespace std;
using ll=long long;
using ull=unsigned long long;
#define rep(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rrep(i,a,b) for(ll i=(ll)(a-1);i>=(ll)(b);i--)
#define MOD 998244353
//#define MOD 1000000007
#define INF 1e18
#define Pair pair<ll,ll>
//#define PI numbers::pi
//#define E numbers::e
template <typename T> bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
ll t; cin >> t;
while(t--){
ll n; cin >> n;
double s; cin >> s;
vector<ll> p;
rep(i,1,1001){
ll a=ceil(s*i),b=ceil((s+0.001)*i);
if(a<b) p.push_back(i);
}
ll x=n/1000,y=n%1000;
cout << p.size()*x+distance(p.begin(),upper_bound(p.begin(),p.end(),y)) << endl;
}
}
ragna