結果
問題 | No.2624 Prediction by Average |
ユーザー |
|
提出日時 | 2024-02-09 22:05:00 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,192 bytes |
コンパイル時間 | 1,515 ms |
コンパイル使用メモリ | 167,780 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-28 15:18:48 |
合計ジャッジ時間 | 3,450 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 1 WA * 4 |
ソースコード
// 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)<<endltypedef 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;ld S;bool Med;int main(){cerr<<fabs(&Med-&Mbe)/1048576.0<<"MB\n";cin>>T;while(T--){cin>>n>>S;ll ans=0;for(ld i=0.0000;i<=0.0009;i+=0.0001){ld qd=S+i;rep(j,1,1000){ld ru=qd*j;ll oo=round(ru);ld qdqd=oo*1.0/j;ld o=floor(qdqd*1000)/1000.0;if(fabs(o-qd)<=1e-7){// cout<<qdqd<<" "<<floor(qdqd*1000)<<endl;// cout<<o<<" "<<qd<<endl;ans+=n/1000+((n-1)%1000>=j-1);}}}write(ans),putchar('\n');}return 0;}