QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#266497#6648. 总投票数PiggiesAndPony#AC ✓379ms3700kbC++201.6kb2023-11-26 14:39:262023-11-26 14:39:27

Judging History

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

  • [2023-11-26 14:39:27]
  • 评测
  • 测评结果:AC
  • 用时:379ms
  • 内存:3700kb
  • [2023-11-26 14:39:26]
  • 提交

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 int ll
#define N 110
int n;
ll a[N], p10[20];
string s[N];
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';
		for (int j = 2; j <= s[i].length() - 1; j ++)
		{
			a[i] = a[i] * 10 + s[i][j] - '0';
		}
		a[i] = a[i] * 10;
	}
	for (int K = 1;; K ++)
	{
		int flag = 1, sl = 0, sr = 0;
		for (int i = 1; i <= n; i ++)
		{
			int l = (a[i] - 5) * K, r = (a[i] + 5) * K - 1;
			if ((l + p10[len + 1] - 1) / p10[len + 1] > (r / p10[len + 1])) {flag = 0; break;}
			sl += (l + p10[len + 1] - 1) / p10[len + 1], sr += (r / p10[len + 1]);
		}
		if (flag && sl <= K && K <= sr) {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);
	p10[0] = 1;
	for (int i = 1; i <= 18; i ++)p10[i] = 10LL * p10[i - 1];
	int T = 1;
	while (T --)sol();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 18ms
memory: 3580kb

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:

942983

result:

ok 1 number(s): "942983"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

100
0.0
0.1
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.1
0.0
0.1
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.1
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
...

output:

10

result:

ok 1 number(s): "10"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

100
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0.01
0...

output:

100

result:

ok 1 number(s): "100"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

20
0.060
0.070
0.000
0.030
0.070
0.060
0.040
0.040
0.030
0.040
0.050
0.050
0.070
0.060
0.100
0.040
0.060
0.060
0.040
0.030

output:

100

result:

ok 1 number(s): "100"

Test #5:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

100
0.0103
0.0102
0.0086
0.0114
0.0102
0.0087
0.0095
0.0104
0.0106
0.0105
0.0089
0.0111
0.0085
0.0103
0.0112
0.0111
0.0106
0.0103
0.0101
0.0089
0.0092
0.0085
0.0113
0.0096
0.0103
0.0096
0.0104
0.0110
0.0090
0.0116
0.0104
0.0106
0.0110
0.0112
0.0081
0.0103
0.0114
0.0097
0.0101
0.0100
0.0086
0.0099
0....

output:

9703

result:

ok 1 number(s): "9703"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

14
0.00161
0.01926
0.02568
0.03852
0.04013
0.07063
0.06902
0.07223
0.08507
0.07544
0.10273
0.11717
0.13644
0.14607

output:

623

result:

ok 1 number(s): "623"

Test #7:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

100
0.010768
0.012237
0.011258
0.010768
0.006853
0.007342
0.008321
0.009300
0.011258
0.008811
0.010279
0.011258
0.010768
0.010768
0.015174
0.009790
0.009790
0.010279
0.011747
0.006853
0.011258
0.010279
0.006363
0.014195
0.012237
0.008321
0.008811
0.011258
0.006853
0.008321
0.010279
0.006853
0.007342...

output:

2043

result:

ok 1 number(s): "2043"

Test #8:

score: 0
Accepted
time: 16ms
memory: 3612kb

input:

100
0.002514
0.002522
0.002533
0.002519
0.002498
0.002590
0.002470
0.002604
0.002461
0.002578
0.002507
0.002557
0.002503
0.002391
0.002521
0.002564
0.002519
0.002569
0.002521
0.002424
0.002515
0.002533
0.002438
0.002396
0.002459
0.002509
0.002532
0.002537
0.002524
0.002454
0.002486
0.002581
0.002463...

output:

923702

result:

ok 1 number(s): "923702"

Test #9:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

100
0.002311
0.001651
0.000990
0.001321
0.001981
0.002641
0.002641
0.001651
0.002311
0.000990
0.001981
0.002641
0.001651
0.001651
0.004622
0.003301
0.003301
0.002641
0.002311
0.001981
0.002971
0.001651
0.002311
0.003632
0.000990
0.003962
0.001651
0.002641
0.002641
0.003301
0.003301
0.000990
0.003301...

output:

3029

result:

ok 1 number(s): "3029"

Test #10:

score: 0
Accepted
time: 16ms
memory: 3628kb

input:

100
0.000041
0.000230
0.000455
0.000622
0.000901
0.001081
0.001270
0.001464
0.001590
0.001820
0.002045
0.002203
0.002498
0.002681
0.002955
0.003074
0.003152
0.003468
0.003672
0.003890
0.004021
0.004302
0.004481
0.004757
0.004904
0.005011
0.005250
0.005530
0.005572
0.005871
0.005954
0.006223
0.006327...

output:

927560

result:

ok 1 number(s): "927560"

Test #11:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

1
1.000000

output:

1

result:

ok 1 number(s): "1"

Test #12:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

100
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000...

output:

1

result:

ok 1 number(s): "1"

Test #13:

score: 0
Accepted
time: 379ms
memory: 3512kb

input:

100
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000...

output:

666667

result:

ok 1 number(s): "666667"

Test #14:

score: 0
Accepted
time: 189ms
memory: 3608kb

input:

100
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001
0.000001...

output:

994975

result:

ok 1 number(s): "994975"

Test #15:

score: 0
Accepted
time: 17ms
memory: 3700kb

input:

100
0.000045
0.000046
0.000047
0.000048
0.000049
0.000050
0.000051
0.000052
0.000053
0.000054
0.000055
0.000056
0.000057
0.000058
0.000059
0.000060
0.000061
0.000062
0.000063
0.000064
0.000065
0.000066
0.000067
0.000068
0.000069
0.000070
0.000071
0.000072
0.000073
0.000074
0.000075
0.000076
0.000077...

output:

1000000

result:

ok 1 number(s): "1000000"

Test #16:

score: 0
Accepted
time: 66ms
memory: 3580kb

input:

100
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000...

output:

125072

result:

ok 1 number(s): "125072"

Test #17:

score: 0
Accepted
time: 1ms
memory: 3684kb

input:

100
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000...

output:

256

result:

ok 1 number(s): "256"