1 #include<cstdio> 2 bool Judge(int A[], int num){ 3 for(int i = 0; i < num; i++){ 4 if(A[i] == A[num-1-i]) 5 return true; 6 else 7 return false; 8 } 9 } 10 int main(){ 11 int N, b, A[40], num = 0; 12 scanf("%d %d", &N, &b); 13 /*-------进制转换--------*/ 14 do{ 15 A[num++] = N % b; 16 N /= b; 17 }while(N != 0 ); 18 /*-----------------------*/ 19 bool flag = Judge(A, num); 20 if(flag == true) 21 printf("Yes\n"); 22 else 23 printf("No\n"); 24 for(int i = num - 1; i >= 0; i--){ 25 printf("%d", A[i]); 26 if(i != 0) 27 printf(" "); 28 } 29 return 0; 30 }
原文地址:https://www.cnblogs.com/zjsaipplp/p/10415790.html
时间: 2024-10-06 16:33:28