QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#266475 | #6648. 总投票数 | PiggiesAndPony# | WA | 16ms | 3332kb | C++20 | 1.5kb | 2023-11-26 14:29:55 | 2023-11-26 14:29:56 |
Judging History
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;
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;}
}
// 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);
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: 0
Wrong Answer
time: 16ms
memory: 3332kb
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'