QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#141457 | #5253. Denormalization | PhantomThreshold# | WA | 1ms | 3676kb | C++20 | 922b | 2023-08-17 13:53:22 | 2023-08-17 13:53:23 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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]