QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#111998 | #5253. Denormalization | xaphoenix# | WA | 2ms | 3584kb | C++14 | 1.6kb | 2023-06-09 13:41:55 | 2023-06-09 13:41:56 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define LC k<<1
#define RC k<<1|1
#define IO cin.sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define rep(i,a,n) for (int i = a; i < n; i++)
#define repn(i,a,n) for (int i = a; i <= n; i++)
#define per(i,a,n) for (int i = (n) - 1; i >= a; i--)
#define pern(i,a,n) for (int i = n; i >= a; i--)
typedef long long LL;
typedef long double LD;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<int, LL> PIL;
typedef pair<LL, int> PLI;
typedef pair<double, double> PDD;
typedef pair<ull, ull> PUU;
typedef pair<LL, LL> PLL;
const int N = 11000;
const int M = 1100000;
const int mod = 1e9+7;
const int inf = (int)1e9;
const LL INF = 1e18;
const double eps = 1e-9;
mt19937_64 Rand((unsigned long long)new char);
#define rand Rand
int n;
LD f[N];
int a[N];
int main() {
IO;
cin >> n;
repn(i, 1, n) cin >> f[i];
repn(x, 1, 10000) {
a[1] = x;
int flag = 0;
LD d = (LD)a[1] * a[1];
repn(i, 2, n) {
LD val = a[1] * f[i] / f[1];
a[i] = round(val);
d += (LD)a[i] * (LD)a[i];
if (abs(val - a[i]) > eps) {
flag = 1;
break;
}
}
if (flag) continue;
d = sqrt(d);
repn(i, 1, n) {
LD y = a[i] / d;
if (abs(y - f[i]) > eps) {
flag = 1;
break;
}
}
if (flag) continue;
int m = a[1];
repn(i, 2, n) m = __gcd(m, a[i]);
if (m != 1) continue;
break;
}
repn(i, 1, n) cout << a[i] << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3584kb
input:
2 0.909840249060 0.414958698174
output:
10000 4561
result:
wrong answer incorrect solution