Monday, September 16, 2019

Codeforce A. Collecting Beats is Fun

  1. #include< bits/stdc++.h >
  2. using namespace std;
  3. int main(){
  4. int k;
  5. char a;
  6. cin >> k;
  7. int ar[10] = {0};
  8. for(int i = 0; i < 16; i++){
  9. cin >> a;
  10. ar[a]++;
  11. }
  12. for(int i = 1; i < 10; i++)
  13. if(ar[i+'0'] > 2*k) return cout << "NO\n", 0;
  14. cout << "YES\n";
  15. return 0;
  16. }

No comments: