QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#729861 | #6648. 总投票数 | PlentyOfPenalty# | TL | 0ms | 0kb | C++20 | 1.2kb | 2024-11-09 17:57:42 | 2024-11-09 17:57:42 |
answer
#include <bits/stdc++.h>
#define sz(x) ((int)(x).size())
#define all(x) begin(x), end(x)
#ifdef memset0
#define log(...) fprintf(stderr, __VA_ARGS__)
#else
#define endl '\n'
#define log(...) (void(0))
#endif
using namespace std;
using ll = long long;
using lf = long double;
using ull = unsigned long long;
const int N = 109;
int n, m, l[N], r[N], bis;
string s;
int main() {
#ifdef memset0
freopen("D.in", "r", stdin);
#endif
cin.tie(0)->sync_with_stdio(0);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> s;
m = s.length() - 2;
int x = 0;
for (int c : s)
if (c != '.') {
x = x * 10 + c - '0';
}
x *= 10;
l[i] = x - 5;
r[i] = x + 5;
}
for (int i = 1; i <= n; i++) {
log("> %d %d\n", l[i], r[i]);
}
bis = 1;
for (int i = 0; i <= m; i++) {
bis *= 10;
}
log("> %d\n", bis);
for (int d = 1; d <= bis; d++) {
long long sl = 0, sr = 0;
for (int i = 1; i <= n; i++) {
long long t = r[i] * d / bis;
sr += t;
while ((t - 1) * bis >= d * l[i]) {
--t;
}
sl += t;
}
if (sl <= d && d <= sr) {
cout << d << endl;
return 0;
}
}
}
詳細信息
Test #1:
score: 0
Time Limit Exceeded
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...