blob: 85cd80f9ac76b7cc612e3288d8dbbb4f7c04c9f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#include <iostream>
#include <fstream>
#include <sstream>
#include <time.h>
using namespace std;
int main(void)
{
ifstream filein;
ofstream fileout;
filein.open("input.txt");
fileout.open("output.txt");
time_t rawtime;
struct tm * timeinfo;
int num[4], i = 0, j = 1, diff, tot[2];
char ch;
string cc;
while(!filein.eof())
{
filein.get(ch);
if(ch != ' '){
cc+=ch;
istringstream(cc) >> num[i];
}else {
i++;
cc = "";
}
}
time(&rawtime);
timeinfo = localtime(&rawtime);
for(i = 0; i < 2; i++){
timeinfo->tm_year = 2001-1900;
timeinfo->tm_mon = num[j]-1;
timeinfo->tm_mday = num[j-1];
mktime(timeinfo);
tot[i] = timeinfo->tm_yday+1;
j = 3;
}
diff = tot[1] - tot[0];
fileout << diff;
filein.close();
fileout.close();
return 0;
}
|