QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#475622 | #9129. Quotient Sum | ucup-team061# | WA | 1ms | 5696kb | C++20 | 1.1kb | 2024-07-13 15:57:51 | 2024-07-13 15:57:51 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define int ll
#define fr first
#define se second
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define all(x) x.begin(),x.end()
#define For(i,a,b) for(int i = a; i <= b; ++i)
#define Rep(i,a,b) for(int i = a; i >= b; --i)
using namespace std;
typedef pair<int,int> pii;
#ifdef OVAL
const int N = 2e3+10;
#else
const int N = 2e5+10;
#endif
int n, a[N], pre[N];
void solve()
{
cin >> n;
For(i,1,n)cin >> a[i];
sort(a+1, a+1+n, greater<>());
int ans = 0;
For(i,1,n-1)ans += a[i]/a[i+1];
sort(a+2, a+1+n);
For(i,3,n){
pre[i] = pre[i-1] + a[i]/a[i-1];
}
ans = min(ans, a[1]/a[2]);
cout << ans << '\n';
}
signed main()
{
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
int tt = 1;
// cin >> tt;
For(tc,1,tt){
solve();
}
return 0;
}
/*
9
284791808 107902 13660981249408 4622332661 13405199 24590921 361 244448137 16077087227955422
*/
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 5696kb
input:
3 2 3 6
output:
3
result:
ok "3"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
2 15 4
output:
3
result:
ok "3"
Test #3:
score: 0
Accepted
time: 0ms
memory: 5628kb
input:
9 284791808 107902 13660981249408 4622332661 13405199 24590921 361 244448137 16077087227955422
output:
4580
result:
ok "4580"
Test #4:
score: -100
Wrong Answer
time: 1ms
memory: 5692kb
input:
9 12 9 5 17 2 6 7 1 15
output:
10
result:
wrong answer 1st words differ - expected: '6', found: '10'