标签:io for div 代码 amp as br ca return
#include <stdio.h> int main() { int n,i,j,l,p,sum,pp,k,m,ppppp; int a[1000],b[1000]; while(scanf("%d",&n)&&n) { ppppp=0;pp=0; for(i=2;i<=16;i++) { m=n; sum=0;p=0; while(m!=0) { a[p++]=m%i; m/=i; } l=p; for(k=0;k<l/2;k++) { if(a[k]!=a[l-1-k]) break; } if(k==l/2) { sum++; } if(sum) { b[pp++]=i; sum=0; ppppp=1; } } if(ppppp) { printf("Number %d is palindrom in basis",n); for(i=0;i<pp;i++) { printf(" %d",b[i]); } printf("\n"); } else { printf("Number %d is not a palindrom\n",n); } } return 0; }
标签:io for div 代码 amp as br ca return
原文地址:http://blog.csdn.net/sky_miange/article/details/41748175