Skip to content

Commit 001aae5

Browse files
committed
Added 1730A - Planets.cpp
1 parent c2c4b25 commit 001aae5

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

Diff for: 1730A - Planets.cpp

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// ॐ नमः शिवाय
2+
#include<bits/stdc++.h>
3+
using namespace std;
4+
#define ll long long
5+
6+
// Code Written By: Vikash Patel
7+
// Codeforces Profile: https://codeforces.com/profile/vikashpatel
8+
9+
int main()
10+
{
11+
ios_base::sync_with_stdio(0);
12+
cin.tie(0);
13+
14+
int t;
15+
cin>>t;
16+
while(t--)
17+
{
18+
int n, c;
19+
cin >> n >> c;
20+
unordered_map<int, int> m;
21+
for (int i = 1; i <= n; i++)
22+
{
23+
int x;
24+
cin>>x;
25+
m[x]++;
26+
}
27+
int ans = 0;
28+
for(auto x : m)
29+
{
30+
if(x.second >= c)
31+
ans += c;
32+
else
33+
ans += x.second;
34+
}
35+
cout<<ans<<endl;
36+
}
37+
return 0;
38+
}

0 commit comments

Comments
 (0)