Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int days = 0;
- int daysInOneYear = 365;
- int counterYears = 0;
- int leftDays = 0;
- cin >> days;
- while (true)
- {
- if (counterYears % 4 == 0)
- {
- daysInOneYear = 366;
- if (counterYears % 400 == 0)
- {
- daysInOneYear = 366;
- }
- if (counterYears % 100 == 0)
- {
- daysInOneYear = 365;
- }
- }
- else
- {
- daysInOneYear = 365;
- }
- if (counterYears % 100 == 0)
- {
- daysInOneYear = 365;
- }
- leftDays = days - daysInOneYear;
- counterYears++;
- days = leftDays;
- if (leftDays <= 0)
- {
- break;
- }
- }
- cout << counterYears << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement