题目描述
include[HTML_REMOVED]
include[HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
int main()
{
int a1,a2,a3,a4,n;
int res=0,t=5;
while(t–)
{
cin>>n;
a1=n/1000;
a2=n%1000/100;
a3=n%1000%100/10;
a4=n%1000%100%10/1;
if(a1==a3&&a4==a2+1)
res++;
} cout<<res<<endl;
}
样例
include[HTML_REMOVED]
include[HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
int res=0,t=5;
string st;
int main()
{
while(t–)
{
cin>>st;
if(st[0]==st[2]&&st[1]+1==st[3])
res++;
}
cout<<res<<endl;
}