Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
#include <iostream>
using namespace std;
const int MAX = 1e6+1;
int count[MAX];
int main(){
freopen("TEAM.INP",'r',stdin);
freopen("TEAM.OUT",'w',stdout);
int n,res=0;cin>>n;
for (int i = 0 ; i< MAX;++i) count[i] = 0;
for (int i = 0 ; i < n;++i){
int x;cin>>x;
++count[x];
}
for ( int i = 1 ; i < MAX;++i) res += count[i]/i;
cout<<res;
}
Hãy giúp mọi người biết câu trả lời này thế nào?
#include <iostream>
#include <map>
#define fi first
#define se second
using namespace std;
int main() {
int n;
cin >> n;
map<int,int> a;
int p;
for (int i=0; i<n; i++) {
cin >> p;
a[p]++;
}
int ans = 0;
for (auto i:a) {
ans+=i.se/i.fi;
}
cout << ans;
}
Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin
7
175
2
1e6 là j đấy ạ
91
1837
37
10^6 ấy bn
7
175
2
Cảm ơn nha