QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#266456#6648. 总投票数PiggiesAndPony#WA 2ms3572kbC++201.6kb2023-11-26 14:23:122023-11-26 14:23:12

Judging History

你现在查看的是最新测评结果

  • [2023-11-26 14:23:12]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3572kb
  • [2023-11-26 14:23:12]
  • 提交

answer

#include<bits/stdc++.h>
#define inf 1e9
#define eps 1e-10
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define REP(i,a,b) for(int i=a;i>=b;i--)
#define db double
#define ve vector<int>
#define pa pair<int,int>
#define fr first
#define sd second
#define pb push_back
#define mp make_pair
#define MEM(a) memset(a,0,sizeof(a))
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
inline ll read()
{
	char ch = getchar();
	ll s = 0, w = 1;
	while (ch < '0' || ch > '9') {if (ch == '-')w = -1; ch = getchar();}
	while (ch >= '0' && ch <= '9') {s = s * 10 + ch - '0'; ch = getchar();}
	return s * w;
}
#define N 110
int n;
double a[N];
string s[N];
int cl(double c)
{
	int s = 0;
	while (c > eps)
	{
		c = c * 10;
		c = c - floor(c);
		s ++;
	}
	return s;
}
void sol()
{
	cin >> n;
	for (int i = 1; i <= n; i ++)cin >> s[i];
	int len = s[1].length() - 2;
	for (int i = 1; i <= n; i ++)
	{
		a[i] = s[i][0] - '0';
		double t = 1;
		for (int j = 2; j <= s[i].length() - 1; j ++)
		{
			t = t / 10.0;
			a[i] = a[i] + (s[i][j] - '0') * t;
		}
	}
	double EPS = 1.0 / 2.0 * pow(10, -len);
	for (int K = 1;; K ++)
	{
		int flag = 1;
		for (int i = 1; i <= n; i ++)
		{
			double l = (a[i] - EPS) * K, r = (a[i] + EPS) * K - eps;
			// if (K == 7)cout << l << ' ' << r << endl;
			if (ceil(l) > floor(r)) {flag = 0; break;}
		}
		// if (flag)return ;
		if (flag) {cout << K << '\n'; return ;}
	}
}
signed main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int T = 1;
	while (T --)sol();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3572kb

input:

100
0.009862
0.010100
0.009996
0.010052
0.009983
0.009759
0.009846
0.010008
0.010085
0.009909
0.010107
0.010161
0.010011
0.009956
0.009948
0.009979
0.010020
0.009991
0.010060
0.010080
0.009949
0.009897
0.010135
0.010042
0.010003
0.009957
0.009934
0.009838
0.010195
0.010249
0.009908
0.009959
0.010060...

output:

925478

result:

wrong answer 1st numbers differ - expected: '942983', found: '925478'