SHARE
TWEET

Untitled

a guest Nov 9th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int days = 0;
  8.     int daysInOneYear = 365;
  9.     int counterYears = 0;
  10.     int leftDays = 0;
  11.  
  12.     cin >> days;
  13.  
  14.     while (true)
  15.     {
  16.         if (counterYears % 4 == 0)
  17.         {
  18.             daysInOneYear = 366;
  19.  
  20.             if (counterYears % 400 == 0)
  21.             {
  22.                 daysInOneYear = 366;
  23.             }
  24.             if (counterYears % 100 == 0)
  25.             {
  26.                 daysInOneYear = 365;
  27.             }
  28.  
  29.         }
  30.         else
  31.         {
  32.             daysInOneYear = 365;
  33.         }
  34.  
  35.         if (counterYears % 100 == 0)
  36.         {
  37.             daysInOneYear = 365;
  38.         }
  39.  
  40.         leftDays = days - daysInOneYear;
  41.         counterYears++;
  42.         days = leftDays;
  43.        
  44.  
  45.  
  46.         if (leftDays <= 0)
  47.         {
  48.             break;
  49.         }
  50.  
  51.  
  52.     }
  53.     cout << counterYears << endl;
  54.  
  55.  
  56.  
  57.     return 0;
  58. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top