QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#141457#5253. DenormalizationPhantomThreshold#WA 1ms3676kbC++20922b2023-08-17 13:53:222023-08-17 13:53:23

Judging History

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

  • [2023-08-17 13:53:23]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3676kb
  • [2023-08-17 13:53:22]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

typedef long double db;
const db eps=1e-8;
int sign(db k){
	if (k<-eps) return -1;
	else if (k>eps) return 1;
	return 0;
}
long long downdiv(db a,db b){
	long long tmp=a/b;
	return tmp;
}
db mod(db a,db b){
	return a-downdiv(a,b)*b;
}

db gcd(db a,db b){
//	cerr << "gcd : " << a << " " << b << endl;
	if (sign(b)==0) return a;
	if (sign(a-b)==0) return a;
	return gcd(b,mod(a,b));
}

const int maxn=10000;
int n;
db a[maxn+50];
long long ans[maxn+50];

int main(){
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	cin >> n;
	for (int i=1;i<=n;i++) cin >> a[i];
	
	db g=a[1];
	for (int i=2;i<=n;i++){
	//	cerr << "----------------" << endl;
		g=gcd(g,a[i]);
	//	cout << "g : " << g << "\n";
	}
	for (int i=1;i<=n;i++) ans[i]=a[i]/g+0.5;
	for (int i=1;i<=n;i++) cout << ans[i] << " \n"[i==n];
	return 0;	
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3620kb

input:

2
0.909840249060
0.414958698174

output:

9665 4408

result:

ok good solution

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3676kb

input:

3
0.005731604132
0.696198848562
0.717826101486

output:

61826 7509750 7743038

result:

wrong answer Integer parameter [name=r_i] equals to 61826, violates the range [1, 10000]