QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#476211 | #9129. Quotient Sum | ucup-team3691# | WA | 0ms | 3860kb | C++23 | 908b | 2024-07-13 18:12:23 | 2024-07-13 18:12:23 |
Judging History
answer
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;
void solve() {
int n;
ll mini = 1e18, maxi = 0;
cin >> n;
vector <ll> v(n);
for (int i = 0; i < n; i++) {
cin >> v[i];
mini = min(mini, v[i]);
maxi = max(maxi, v[i]);
}
sort(v.begin(), v.end());
ll sum = 0;
for (int i = 1; i < n; i++) {
sum += v[i] / v[i - 1];
}
ll ans = min(sum, maxi/mini);
cout << ans << '\n';
//cerr << sum << ' ' << maxi/mini << '\n';
}
signed main() {
#ifdef LOCAL
freopen("test.in", "r", stdin);
freopen("test.out", "w", stdout);
#endif // LOCAL
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int nrt = 1;
//cin >> nrt;
while (nrt--) {
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3848kb
input:
3 2 3 6
output:
3
result:
ok "3"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
2 15 4
output:
3
result:
ok "3"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
9 284791808 107902 13660981249408 4622332661 13405199 24590921 361 244448137 16077087227955422
output:
4580
result:
ok "4580"
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3624kb
input:
9 12 9 5 17 2 6 7 1 15
output:
10
result:
wrong answer 1st words differ - expected: '6', found: '10'