QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#101379#5253. DenormalizationDestroyXuanQuang#WA 0ms3640kbC++23679b2023-04-29 12:22:202023-04-29 12:22:21

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-29 12:22:21]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3640kb
  • [2023-04-29 12:22:20]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;

#define int long long

const long double eps = 1e-3;

signed main() {
	ios::sync_with_stdio(0); cin.tie(0);
	
	int n; cin >> n;
	vector<long double> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	for (int a0 = 1; a0 <= 10000; a0++) {
		vector<int> r(n);
		bool ok = 1;
		for (int i = 0; i < n; i++) {
			long double dx = a0/a[0]*a[i];
			r[i] = round(dx);
			if (abs(r[i] - dx) > eps) {
				ok = 0; break;
			}
		}

		if (ok) {
			int g = 0;
			for (int i: r) g = gcd(g, i);
			if (g == 1) {
				for (int i: r) {
					cout << i << '\n';
				}
				return 0;
			}
		}
	}

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3640kb

input:

2
0.909840249060
0.414958698174

output:

296
135

result:

wrong answer incorrect solution