#include <stdio.h>
int cf(int a)
{
int c=1,s=1;
for(c=1;c<=a;c++)
s=s*10;
return s;
}
int pdhw(int shu)
{
int c=shu,a=1,b,d;
while(shu)
{
shu=shu/cf(a);
a=a+1;
}
d=a/2;
for(b=1;b<=d;b++)
{
//printf("%d\n",c/cf(b-1)%10);
//printf("%d\n",c/cf(a-b)%10);
if(c/cf(b-1)%10!=c/cf(a-b)%10) return 0;
}
return 1;
}
main()
{
int shu,a=1,b,c;
shu=7357;
printf("%d",pdhw(shu));
getchar();
}
#include <stdio.h>
#include <math.h>
int pdhw(int shu)
{
int c=shu,a=1,b,d;
while(shu)
{
shu=shu/((int)pow(10,a));
a=a+1;
}
d=a/2;
for(b=1;b<=d;b++)
{
if(c/((int)pow(10,b-1))%10!=c/((int)pow(10,a-b))%10) return 0;
}
return 1;
}
main()
{
int shu,a=1,b,c;
shu=7337;
printf("%d",pdhw(shu));
getchar();
}
#include <stdio.h>
#include <string.h>
int pdhw(int shu)
{
int c=shu,a=1,b,d;
char zf[100];
sprintf(zf,"%d",shu);
b=strlen(zf);
printf("%d\n",b);
for(a=0;a<b/2;a++)
{
printf("%c %c\n",zf[a],zf[b-a-1]);
if(zf[a]!=zf[b-a-1]) return 0;
}
return 1;
}
main()
{
int shu,a=1,b,c;
shu=7337;
printf("%d",pdhw(shu));
getchar();
}
搜索
复制
原文链接: https://www.cnblogs.com/xkdn/p/16216884.html
欢迎关注
微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍
原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/188978
非原创文章文中已经注明原地址,如有侵权,联系删除
关注公众号【高性能架构探索】,第一时间获取最新文章
转载文章受原作者版权保护。转载请注明原作者出处!