Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <cstdio>
- #include <vector>
- using namespace std;
- int day1(int days, int m_1, int m_2, int d_1, int d_2, int k)
- {
- for (int i = 1; i <= m_2; i++)
- {
- if (i == 2)
- {
- days -= k;
- }
- else if ((i <= 7 && i % 2 != 0) || (i > 7 && i % 2 == 0))
- {
- days -= 31;
- }
- else days -= 30;
- }
- if (m_2 != 2)
- {
- if ((m_2 <= 7 && m_2 % 2 != 0) || (m_2 > 7 && m_2 % 2 == 0))
- {
- days += 31 - d_2;
- }
- else days += 30 - d_2;
- }
- else days += k - d_2;
- for (int i = m_1; i <= 12; i++)
- {
- if (i == 2)
- {
- days -= k;
- }
- else if ((i <= 7 && i % 2 != 0) || (i > 7 && i % 2 == 0))
- {
- days -= 31;
- }
- else days -= 30;
- }
- days += d_1;
- return days;
- }
- int day2(int days, int m_1, int m_2, int d_1, int d_2, int k)
- {
- }
- int main()
- {
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif // !ONLINE_JUDGE
- int year_cur;
- int d_birth, m_birth, d_cur, m_cur, days;
- scanf("%d %d %d %d %d", &d_birth, &m_birth, &d_cur, &m_cur, &year_cur);
- if (m_birth > m_cur)
- {
- if ((year_cur % 400 == 0) || (year_cur % 4 == 0 && year_cur % 100 != 0))
- {
- days = day1(366, m_birth, m_cur, d_birth, d_cur, 29);
- }
- else
- {
- days = day1(365, m_birth, m_cur, d_birth, d_cur, 28);
- }
- }
- else if (m_birth < m_cur)
- {
- if (((year_cur + 1) % 400 == 0) || ((year_cur + 1) % 4 == 0 && (1 + year_cur) % 100 != 0))
- {
- }
- else
- {
- }
- }
- printf("%d", days);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement