QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#94494 | #5253. Denormalization | maomao90# | WA | 0ms | 3660kb | C++17 | 1.8kb | 2023-04-06 14:11:58 | 2023-04-06 14:11:59 |
Judging History
answer
// Hallelujah, praise the one who set me free
// Hallelujah, death has lost its grip on me
// You have broken every chain, There's salvation in your name
// Jesus Christ, my living hope
#include <bits/stdc++.h>
using namespace std;
#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define RREP(i, s, e) for (int i = (s); i >= (e); i--)
template <class T>
inline bool mnto(T& a, T b) {return a > b ? a = b, 1 : 0;}
template <class T>
inline bool mxto(T& a, T b) {return a < b ? a = b, 1: 0;}
typedef long long ll;
typedef long double ld;
#define FI first
#define SE second
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> iii;
#define ALL(_a) _a.begin(), _a.end()
#define SZ(_a) (int) _a.size()
#define pb push_back
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<iii> viii;
#ifndef DEBUG
#define cerr if (0) cerr
#endif
const int INF = 1000000005;
const ll LINF = 1000000000000000005ll;
const int MAXN = 10000;
int n;
ld x[MAXN];
int ans[MAXN];
int main() {
#ifndef DEBUG
ios::sync_with_stdio(0), cin.tie(0);
#endif
cin >> n;
ld mnx = INF;
REP (i, 0, n) {
cin >> x[i];
mnto(mnx, x[i]);
}
while (mnx * 10 < 1) {
mnx *= 10;
REP (i, 0, n) {
x[i] *= 10;
}
}
ld mn = INF;
int ak = -1;
REP (k, 1, MAXN * 10) {
ld error = 0;
REP (i, 0, n) {
ld tx = x[i] * k;
error += abs(round(tx) - tx);
}
if (mnto(mn, error)) {
ak = k;
}
}
REP (i, 0, n) {
ans[i] = round(x[i] * ak);
}
int g = 0;
REP (i, 0, n) {
g = __gcd(g, ans[i]);
}
REP (i, 0, n) {
ans[i] /= g;
}
REP (i, 0, n) {
cout << ans[i] << '\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3660kb
input:
2 0.909840249060 0.414958698174
output:
82124 37455
result:
wrong answer Integer parameter [name=r_i] equals to 82124, violates the range [1, 10000]