QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#477560 | #9129. Quotient Sum | ucup-team3695# | WA | 0ms | 3636kb | C++20 | 690b | 2024-07-14 05:54:05 | 2024-07-14 05:54:06 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define pb push_back
#define mp make_pair
#define MAXN 200'010
ll a[MAXN];
int main() {
cin.tie(0)->sync_with_stdio(0);
cin.exceptions(cin.failbit);
int n;
cin >> n;
rep(i, 0, n) cin >> a[i];
sort(a, a+n);
ll o1 = 0;
rep(i, 1, n) {
o1 += a[i] / a[i-1];
}
o1 += a[0] / a[n-1];
reverse(a, a+n);
ll o2 = 0;
rep(i, 1, n) {
o2 += a[i] / a[i-1];
}
o2 += a[0] / a[n-1];
cout << min(o1, o2) << endl;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3484kb
input:
3 2 3 6
output:
3
result:
ok "3"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
2 15 4
output:
3
result:
ok "3"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3620kb
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: 3632kb
input:
9 12 9 5 17 2 6 7 1 15
output:
10
result:
wrong answer 1st words differ - expected: '6', found: '10'