QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#90163#5253. Denormalizationchiranko#WA 2ms3640kbC++14809b2023-03-22 14:02:572023-03-22 14:03:01

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-22 14:03:01]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3640kb
  • [2023-03-22 14:02:57]
  • 提交

answer

#include<bits/stdc++.h>
#define rep(l,r) for(int i=l;i<=r;i++)
#define jrep(l,r) for(int j=l;j<=r;j++)

using namespace std;

typedef long double LD;
typedef long long ll;
const int N=1e4+10;

int n;
LD a[N];
int b[N],c[N];
LD p[N];

bool check(int x)
{
	rep(1,n)c[i]=round((double)b[i]/x);
	int d=c[1];
	rep(1,n)d=__gcd(d,c[i]);
	rep(1,n)c[i]/=d;
	rep(1,n)if(c[i]>10000)return false;
	LD q=0;
	rep(1,n)q+=(LD)b[i]*b[i];
	q=sqrt(q);
	rep(1,n)p[i]=b[i]/q;
	rep(1,n)if(fabsl(p[i]-a[i])>1e-6)return false;
	return true;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	rep(1,n)cin>>a[i];
	rep(1,n)b[i]=round(sqrtl(a[i]*a[i]*1e16));
	rep(1,10000)if(check(i))
	{
		jrep(1,n)cout<<c[j]<<"\n";
		//jrep(1,n)cout<<p[j]<<"\n";
		return 0;
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3496kb

input:

2
0.909840249060
0.414958698174

output:

9073
4138

result:

ok good solution

Test #2:

score: -100
Wrong Answer
time: 2ms
memory: 3640kb

input:

3
0.005731604132
0.696198848562
0.717826101486

output:

71
8627
8895

result:

wrong answer incorrect solution