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