Wildcxj @ 2020-06-25 10:54:32
#include<iostream>
using namespace std;
int nian(int m)
{
return m / 10000000 % 10 * 1000 + m / 1000000 % 10 * 100 + m / 100000 % 10 * 10 + m / 10000 % 10;
}
int yue(int m)
{
return m / 1000 % 10 * 10 + m / 100 % 10;
}
int ri(int m)
{
return m / 10 % 10 * 10 + m % 10;
}
int dao(int a)
{
int rt=0,cnt=1000;
while (a != 0)
{
rt += a % 10 * cnt;
a /= 10;
cnt /= 10;
}
return rt;
}
int s[13] = { 0,31,29,31,30,31,30,31,31,30,31,30,31 };
int main()
{
int a, b,cnt=0;
cin >> a >> b;
for (int i = nian(a); i <= nian(b); i++)
{
if (i == nian(a))
{
if (yue(i * 1000 + dao(i)) == yue(a))
{
if (ri(i * 1000 + dao(i)) > ri(a))
{
cnt ++;
}
}
else if (yue(i * 1000 + dao(i)) > yue(a))
{
if (yue(i * 1000 + dao(i)) <= 12)
{
cnt++;
}
}
}
else if (i == nian(b))
{
if(yue(i * 1000 + dao(i)) == yue(b))
{
if (ri(i * 1000 + dao(i)) < ri(b))
{
cnt++;
}
}
else if (yue(i * 1000 + dao(i)) < yue(b))
{
if (yue(i * 1000 + dao(i)) <= 12)
{
cnt++;
}
}
}
else
{
if (yue(i * 1000 + dao(i)) <= 12 && ri(i * 1000 + dao(i)) <= s[yue(i * 1000 + dao(i))])
{
cnt++;
}
}
}
cout << cnt;
}
吾乃四年级小学生,即蒟蒻也,帮帮我呀
by ijktmn @ 2020-06-25 11:33:16
@justin2009
另附,我看不惯符号两边带空格
by WanderingTrader @ 2020-06-25 11:34:46
@justin2009 符号两边带空格是个人习惯,没啥的吧(我也带空格的),lz的问题是他的思路非常混乱,看完代码不知所云
by ijktmn @ 2020-06-25 11:37:34
@zycany
我知道,只是看了脑子混乱
by ijktmn @ 2020-06-25 11:38:01
@zycany 另附,我现在在上编程课,看了这份代码,我的脑子都不好了