結果

問題 No.2624 Prediction by Average
ユーザー TairitsuMeowTairitsuMeow
提出日時 2024-02-09 23:30:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 1,017 bytes
コンパイル時間 1,301 ms
コンパイル使用メモリ 168,164 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-02-09 23:30:18
合計ジャッジ時間 1,891 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,548 KB
testcase_01 AC 3 ms
6,548 KB
testcase_02 AC 4 ms
6,548 KB
testcase_03 AC 1 ms
6,548 KB
testcase_04 AC 4 ms
6,548 KB
testcase_05 AC 4 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// Problem: No.2624 Prediction by Average
// Contest: yukicoder
// URL: https://yukicoder.me/problems/no/2624
// Memory Limit: 512 MB
// Time Limit: 2000 ms

#include<bits/stdc++.h>
#define debug(x) cerr<<(#x)<<" "<<(x)<<endl
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define pii pair<ll,ll>
#define rep(i,a,b) for(ll i=(a);i<=(b);++i)
#define per(i,a,b) for(ll i=(a);i>=(b);--i)
using namespace std;
bool Mbe; 
ll read(){
	ll x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
void write(ll x){
	if(x<0)putchar('-'),x=-x;
	if(x>9)write(x/10);
	putchar(x%10+'0');
}
ll T,n,a,b;
bool Med;
int main(){
	cerr<<fabs(&Med-&Mbe)/1048576.0<<"MB\n";
	T=read();
	while(T--){
		n=read(),a=read(),b=read();
		ll q=a*1000+b;
		ll ans=max(0ll,n-1000);
		rep(j,1,min(1000ll,n)){
			ll xa=q*j,xb=(q+1)*j-1;
			if(xa%1000==0||xa/1000!=xb/1000)ans++;
		}
		write(ans),putchar('\n');
	}
	return 0;
}
0