QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#700304 | #5253. Denormalization | Ashbourne | WA | 1ms | 3712kb | C++23 | 865b | 2024-11-02 12:41:01 | 2024-11-02 12:41:02 |
Judging History
answer
#include<bits/stdc++.h>
#define double long double
#define pdd pair<double, int>
using namespace std;
const double eps = 1e-9;
int n, m;
double a, b;
signed main(){
ios::sync_with_stdio(0);
cin >> n;
vector<double>a(n + 1), b(n + 1);
double maxx = 0;
for(int i = 1; i <= n; ++ i){
cin >> a[i];
b[i] = a[i] * a[i];
maxx = max(b[i], maxx);
}
for(int i = 1; i <= 10000; ++ i){
bool flag = 1;
double t;
t = 1.0 * i * i / maxx;
// cout << t << endl;
if(abs(round(t) - t) >= eps) continue;
for(int j = 1; j <= n; ++ j){
double sd = b[j] * t;
double se = sqrt(sd);
if(abs(round(se) - se) >= eps){
flag = 0;
break;
}
}
if(flag){
double fac = sqrt(t);
// cout << fac << endl;
for(int j = 1; j <= n; ++j){
cout << (int)(a[j] * fac + eps) << endl;
}
break;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3712kb
input:
2 0.909840249060 0.414958698174
output:
result:
wrong output format Unexpected end of file - int32 expected