mirror of
https://gitcode.com/Zengtudor/alg2025.git
synced 2025-12-21 06:31:43 +00:00
Compare commits
No commits in common. "6e9562d5cb3955e5814eb811add39c981a1ac5e2" and "929a5ed1888789ea7812f88930661b473fabc87a" have entirely different histories.
6e9562d5cb
...
929a5ed188
@ -5,6 +5,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
// 使用 long long 防止中间结果溢出
|
||||
using ll = long long;
|
||||
|
||||
const int MOD = 1e9 + 7;
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <istream>
|
||||
#include <map>
|
||||
|
||||
using ll = int64_t;
|
||||
ll n;
|
||||
std::map<ll, ll> r;
|
||||
|
||||
int main(){
|
||||
std::iostream::sync_with_stdio(false);
|
||||
std::cin.tie(nullptr);
|
||||
|
||||
std::cin>>n;
|
||||
for(ll i=1;i<=n;i++){
|
||||
ll tmp;
|
||||
std::cin>>tmp;
|
||||
r[tmp]++;
|
||||
}
|
||||
auto idx = r.begin();
|
||||
ll lessn=idx->second;
|
||||
idx++;
|
||||
ll ans=0;
|
||||
for(;idx!=r.end();idx++){
|
||||
ll candel = std::min(idx->second,lessn);
|
||||
lessn-=candel;
|
||||
lessn+=idx->second;
|
||||
ans+=candel;
|
||||
}
|
||||
std::cout<<n-ans<<"\n";
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
class Solution {
|
||||
public:
|
||||
using ll = int64_t;
|
||||
int triangleNumber(vector<int>& nums) {
|
||||
|
||||
}
|
||||
};
|
||||
int main(){}
|
||||
Loading…
Reference in New Issue
Block a user