mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 21:28:48 +00:00
#1514. 【NOIP 十连测 Day 1】平均 (average)
https://sjzezoj.com/submission/60149
This commit is contained in:
parent
a5e7896fd9
commit
14ea5cc0e8
43
S2OJ/1514/1514.cpp
Normal file
43
S2OJ/1514/1514.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 1e6 + 5;
|
||||
|
||||
int n, a[N], cnt, ans;
|
||||
long long sum;
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> n;
|
||||
|
||||
if (n == 1) {
|
||||
cout << 0 << endl;
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> a[i];
|
||||
}
|
||||
|
||||
std::sort(a + 1, a + 1 + n);
|
||||
|
||||
for (int i = 1, p = 1; i <= n; i++) {
|
||||
sum += a[i];
|
||||
|
||||
while (p <= i && a[p] <= sum / i) p++;
|
||||
|
||||
ans = std::max(ans, i - p + 1);
|
||||
}
|
||||
|
||||
cout << ans << endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
S2OJ/1514/data/average1.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average1.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average10.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average10.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average11.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average11.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average11.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average12.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average12.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average12.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average13.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average13.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average13.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average14.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average14.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average14.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average15.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average15.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average15.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average16.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average16.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average16.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average17.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average17.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average17.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average18.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average18.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average18.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average19.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average19.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average19.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average2.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average2.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average20.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average20.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average20.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average3.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average3.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average4.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average4.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average5.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average5.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average6.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average6.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average7.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average7.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average8.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average8.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average9.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average9.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/average9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/average9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/ex_average1.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/ex_average1.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/ex_average1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/ex_average1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/ex_average2.ans
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/ex_average2.ans
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/ex_average2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/ex_average2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1514/data/problem.conf
(Stored with Git LFS)
Normal file
BIN
S2OJ/1514/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user