Jeremiah_

ABC_126 - B - YYMM or MMYY

May 29th, 2019
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.22 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. #define forn(l, r) for(int i = l; i < (r); ++i)
  4. #define forj(l, r) for(int j = l; j < (r); ++j)
  5. #define TAM 1000100
  6. #define SYNC ios::sync_with_stdio(0);
  7. #define $ << ' ' <<
  8. #define F first
  9. #define S second
  10. #define endl '\n'
  11.  
  12.  
  13. using namespace std;
  14.  
  15. using ll = long long int;
  16. using ii = pair<int, int>;
  17. using vii = vector<ii>;
  18. using vi = vector<int>;
  19. using graph = vector<vi>;
  20. const int INF = 0x3f3f3f3f;
  21. const int MAXN = 112345;
  22. const ll mod = 1000000007;
  23.  
  24.  
  25. int main() {
  26.     //SYNC
  27.     string s, ans;
  28.     int a, b;
  29.     cin >> s;
  30.     a = 10*(s[0] - 48) + s[1] - 48;
  31.     b = 10*(s[2] - 48) + s[3] - 48;
  32.     if (a > 12) {
  33.         if (b > 12) {
  34.             ans = "NA";
  35.         }else if(b < 1) {
  36.             cout << "NA";
  37.         } else {
  38.             ans = "YYMM";
  39.         }
  40.     }else if(a < 1) {
  41.         if (b > 12) {
  42.             ans = "NA";
  43.         }else if(b < 1) {
  44.             cout << "NA";
  45.         } else {
  46.             ans = "YYMM";
  47.         }
  48.     } else {
  49.         if (b > 12) {
  50.             ans = "MMYY";
  51.         }else if(b < 1) {
  52.             cout << "MMYY";
  53.         } else {
  54.             ans = "AMBIGUOUS";
  55.         }
  56.     }
  57.     cout << ans << endl;
  58.     return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment