100分但subtask1不对
查看原帖
100分但subtask1不对
1066396
szm111213楼主2024/10/4 10:59
#include <bits/stdc++.h>
using namespace std;
int s[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main()
{
	int a, b, z = 0;
	cin >> a >> b;
//	int y1 = a / 10000, y2 = b / 10000;
//	cout << y1 << " " << y2 << endl;
//	int m1 = a % 10000 / 100, m2 = b % 10000 / 100;
//	cout << m1 << " " << m2 << endl;
//	int d1 = a % 100, d2 = b % 100;
//	cout << d1 << " "  << d2 << endl;
	for(int y = a / 10000; y <= b / 10000; y ++)
	{
		for(int i = 1; i <= 12; i ++)
		{
			for(int j = 1; j <= s[i]; j++)
			{
				int _time = y * 10000 + i * 100 + j;
				string stime = to_string(_time);
				reverse(stime.begin(), stime.end());
				int time_ = stoi(stime);
				if(_time == time_)
				{
					z ++;
				}
			}
		}
	}
	cout << z << endl;
	return 0;
}
2024/10/4 10:59
加载中...