Wuhan University of Science and Technology acm:1010:0 starting point algorithm 12--find the number of days between 2 dates

Source: Internet
Author: User

Problem Description

Water problem

Input

Enter 2 dates, date by month date, month date by symbol-separated (topic contains multiple sets of data)

Output

Find the number of days between these 2 dates (excluding itself), one row per group of test data

Sample Input

2011-1-1

2011-1-5

Sample Output

3

HINT

For simplicity's sake, the assumption entered is 2 dates in the same month and the first date is less than the 2nd date.

1#include <stdio.h>2 3  4 5 intMain ()6 7 {8 9          inty1,m1,d1,y2,m2,d2;Ten  One           while(SCANF ("%d-%d-%d%d-%d-%d", &y1,&m1,&d1,&y2,&m2,&d2)! =EOF) A  -          { -  theprintf"%d", d2-d1-1); -  -          } -  +          return 1; -  +}

Other code:

1#include <stdio.h>2 intMain ()3 {4     intYear1,month1,day1,year2,month2,day2;5      while(~SCANF ("%d-%d-%d", &year1,&month1,&day1) &&~scanf ("%d-%d-%d",&year2,&month2,&day2))6     {7printf"%d\n", day2-day1-1);8     }9}

Wuhan University of Science and Technology acm:1010:0 starting point algorithm 12--find the number of days between 2 dates

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.