結果

問題 No.2624 Prediction by Average
ユーザー KeebyKeeby
提出日時 2024-05-31 03:09:05
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,545 bytes
コンパイル時間 3,152 ms
コンパイル使用メモリ 246,184 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-31 03:09:10
合計ジャッジ時間 4,125 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
//#include <atcoder/modint>
using namespace std;
//using namespace atcoder;
//using mint = modint998244353;
#define rep(i,n) for(long long i=0;i<n;i++)
#define rep1(i,n) for(long long i=1;i<=n;i++)
#define Rep(i,a,b) for(long long i=a;i<=b;i++)
#define all(a) (a).begin(), (a).end()
#define fst first
#define snd second
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> vvec;
typedef vector<long long> vecll;
typedef vector<vector<long long>> vvecll;

//#include<boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

const ll mod=998244353;
//const ll mod=1e9+7;
const ll INF=5e18;
const int INT_INF=1e9;
const double pi=3.14159265358979;

//xのn乗をpで割ったあまりを求める
ll modpow(ll x,ll n,ll p=mod){
  if(n==0) return 1;
  if(n%2==1) return (x*modpow(x,n-1,p))%p;
  else{
    ll t=modpow(x,n/2,p);
    assert(t>0);
    return (t*t)%p;
  }
}

//xの逆元(p:素数)
ll inv(ll x,ll p=mod){
  return modpow(x,p-2,p);
}

template <typename T>
int index(vector<T> &a, T x){
	return lower_bound(all(a),x)-a.begin();
}

int main(){
	int t;
	cin >> t;
	rep(_,t){
		ll n,s,d;
		scanf("%ld %ld.%ld",&n,&d,&s);
		//cout << n << " " << d << " " << s << endl;
		if(n>1000){
			ll ans=0;
			rep1(i,1000){
				ll x=(i*s-1)/1000+1;
				if(x<=((s+1)*i-1)/1000) ans++;
			}
			cout << n-1000+ans << endl;
		}else{
			ll ans=0;
			rep1(i,n){
				ll x=(i*s-1)/1000+1;
				if(x<=((s+1)*i-1)/1000) ans++;
			}
			cout << ans << endl;
		}
	}
	
}
0