Advertisement
BaoJIaoPisu

Untitled

Aug 6th, 2021
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.13 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #define fi first
  3. #define se second
  4. #define pb push_back
  5. #define pf push_front
  6. #define popb pop_back
  7. #define popf pop_front
  8. #define ins insert
  9. #define pq priority_queue
  10. #define minele min_element
  11. #define maxele max_element
  12. #define lb lower_bound //first pos >= val
  13. #define ub upper_bound // first pos > val
  14. #define cnt_bit __builtin_popcount
  15. #define debug(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
  16. //#pragma GCC optimize("Ofast")
  17. //#pragma GCC target("avx,avx2,fma")
  18. using namespace std;
  19.  
  20. mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  21.  
  22. typedef long long ll;
  23. typedef pair<ll, ll> pll;
  24. typedef pair<int, int> pii;
  25.  
  26.  
  27. int d4x[4] = {1, 0, -1, 0}; int d4y[4] = {0, 1, 0, -1};
  28. int d8x[8] = {0, 1, 1, 1, 0, -1, -1, -1};
  29. int d8y[8] = {1, 1, 0, -1, -1, -1, 0, 1};
  30.  
  31. const ll oo = 1e18;
  32. const ll maxN = 1e6;
  33.  
  34. /* Author : Le Ngoc Bao Anh, 10A5, LQD High School for Gifted Student */
  35.  
  36. void maximize(int &a, int b) {
  37.     a = max(a, b);
  38. }
  39.  
  40. void minimize(int &a, int b) {
  41.     a = min(a, b);
  42. }
  43.  
  44. int days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  45.  
  46. void solve() {
  47.     string s; cin >> s;
  48.     int y = 0, m = 0, d = 0, ans = 0;
  49.     for(int i = 0; i < 4; i++) {
  50.         y = y * 10 + (s[i] - '0');
  51.     }
  52.  
  53.     for(int i = 5; i < 7; i++) {
  54.         m = m * 10 + (s[i] - '0');
  55.     }
  56.  
  57.     for(int i = 8; i < 10; i++) {
  58.         d = d * 10 + (s[i] - '0');
  59.     }
  60.  
  61.     while(y != 2021 || m != 7 || d != 23) {
  62.         if(y % 100 == 0) {
  63.             if(y % 400 == 0) days[1] = 29; else days[1] = 28;
  64.         } else if(y % 4 == 0) days[1] = 29; else days[1] = 28;
  65.         d++; ans++;
  66.         if(d > days[m - 1]) {
  67.             d = 1;
  68.             m++;
  69.             if(m > 12) y++, m = 1;
  70.         }
  71.     }
  72.  
  73.     cout << ans;
  74. }
  75.  
  76. int main()
  77. {
  78.     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  79.     #ifndef ONLINE_JUDGE
  80.     freopen("input.txt", "r", stdin);
  81.     freopen("output.txt", "w", stdout);
  82.     #else
  83.     //online
  84.     freopen("olympics.inp", "r", stdin);
  85.     freopen("olympics.out", "w", stdout);
  86.     #endif
  87.  
  88.     int tc = 1, ddd = 0;
  89.     // cin >> tc;
  90.     while(tc--) {
  91.         //ddd++;
  92.         //cout << "Case #" << ddd << ": ";
  93.         solve();
  94.     }
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement