fork(5) download
  1. // Days (A), by Errichto
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4.  
  5. int t[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  6.  
  7. int main() {
  8. int x;
  9. scanf("%d", &x);
  10. char sl[15];
  11. scanf("%s", sl);
  12. scanf("%s", sl);
  13. if(sl[0] == 'w') {
  14. int current = 5;
  15. int ans = 0;
  16. for(int i = 0; i < 366; ++i) {
  17. if(current == x) ++ans;
  18. ++current;
  19. if(current > 7) current = 1;
  20. }
  21. printf("%d\n", ans);
  22. return 0;
  23. }
  24. int c = 0;
  25. for(int i = 0; i < 12; ++i) c += x <= t[i];
  26. printf("%d\n", c);
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
0