fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int TEN = 10;
  5.  
  6. int main() {
  7. int targetEvenDigits, noElements;
  8. cin >> targetEvenDigits >> noElements;
  9. if (targetEvenDigits < 0) {
  10. targetEvenDigits = -targetEvenDigits;
  11. }
  12. for (int i = 1; i <= noElements; ++i) {
  13. int currNum;
  14. cin >> currNum;
  15. int cntEvenDigits = 0;
  16. while (currNum > 0) {
  17. if (currNum % 2 == 0) {
  18. ++cntEvenDigits;
  19. }
  20. currNum /= TEN;
  21. }
  22. if (cntEvenDigits == targetEvenDigits) {
  23. cout << "DA\n";
  24. } else {
  25. cout << "NU\n";
  26. }
  27. }
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0.01s 5320KB
stdin
0 2
1 999999999
stdout
DA
DA