QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#700363 | #5253. Denormalization | Ashbourne | WA | 1ms | 3716kb | C++23 | 952b | 2024-11-02 12:48:49 | 2024-11-02 12:48:49 |
Judging History
answer
#include<bits/stdc++.h>
#define double long double
#define pdd pair<double, int>
using namespace std;
const double eps = 1e-3;
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(t >= 1236) cout << round(t) - t << " " << i << endl;
if(abs(round(t) - t) >= eps) continue;
// cout << i << endl;
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;
}
}
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3716kb
input:
2 0.909840249060 0.414958698174
output:
7945 3623
result:
wrong answer incorrect solution