diff --git a/Luogu/P2010/P2010.cpp b/Luogu/P2010/P2010.cpp new file mode 100644 index 00000000..614c6324 --- /dev/null +++ b/Luogu/P2010/P2010.cpp @@ -0,0 +1,35 @@ +#include +#include +#include +#include + +const int days[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + +struct node { + int year, month, day; +} date1, date2; + +using namespace std; + +int ans; +std::string s1, s2; + +int main() { + scanf("%4d%2d%2d", &date1.year, &date1.month, &date1.day); + scanf("%4d%2d%2d", &date2.year, &date2.month, &date2.day); + for (int yy = date1.year; yy <= date2.year; yy++) { + for (int mm = (yy == date1.year ? date1.month : 1); + mm <= (yy == date2.year ? date2.month : 12); + mm++) { + for (int dd = (yy == date1.year && mm == date1.month ? date1.day : 1); + dd <= (yy == date2.year && mm == date2.month ? date2.day : days[mm]); + dd++) { + s1 = s2 = std::to_string(yy * 10000 + mm * 100 + dd); + std::reverse(s2.begin(), s2.end()); + if (s1 == s2) ans++; + } + } + } + printf("%d\n", ans); + return 0; +} diff --git a/Luogu/P2010/data/P2010_9.in b/Luogu/P2010/data/P2010_9.in new file mode 100644 index 00000000..9ef1231a --- /dev/null +++ b/Luogu/P2010/data/P2010_9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c50219be09140332a2c6c21fa73f565196ccb6f65f726684bcba752e6dc3dff +size 18 diff --git a/Luogu/P2010/data/P2010_9.out b/Luogu/P2010/data/P2010_9.out new file mode 100644 index 00000000..1bfa7175 --- /dev/null +++ b/Luogu/P2010/data/P2010_9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d030dea268935dbd3e2db7c17196757924d0463c5800349904bc5dcf538e1149 +size 4