diff --git a/Codes/1166 A - Silent Classroom/1166A.cpp b/Codes/1166 A - Silent Classroom/1166A.cpp new file mode 100644 index 0000000..4a10496 --- /dev/null +++ b/Codes/1166 A - Silent Classroom/1166A.cpp @@ -0,0 +1,59 @@ +#include +using namespace std; +#ifdef ONLINE_JUDGE +#define dbg(...) +#else +#include "Assets/debug.h" +#endif +#define int long long +#define ll long long +#define endl '\n' +#define ff first +#define ss second +#define ins insert +#define pb push_back +#define ppb pop_back +#define sz(x) (int)(x).size() +#define all(x) x.begin(), x.end() +#define rep(i,a,b) for(int i=a; i=b; --i) +#define yn(f) f? cout<<"YES\n":cout<<"NO\n" +#define FAST (ios_base::sync_with_stdio(false), cin.tie(nullptr)); +ll pow(ll x,ll y,ll m=1e9+7) {ll ans=1;x%=m;while(y){if(y&1)ans=(ans*x)%m;x=(x*x)%m;y>>=1;}return ans;} + +void solve() +{ + int n; + cin>>n; + mapm; + rep(i,0,n) + { + string s; + cin>>s; + m[s[0]]++; + } + dbg(m); + int ans=0; + for(auto [x,y]:m) + { + int c1=y/2; + int c2=y-c1; + int p1=c1*(c1-1)/2; + int p2=c2*(c2-1)/2; + dbg(c1,c2,p1,p2); + ans += p1+p2; + } + cout<> TCS; + for (int TC = 1; TC <= TCS; ++TC) + { + // cout<<"Case "<