#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> #define N 100 int main() { int a,b,d; scanf("%d %d %d",&a,&b,&d); int num[N]; int i=0; int c=a+b; if(c==0){ printf("0"); return 0; } while(c!=0){ num[i++]=(c)%d; c=c/d; } for(int j=i-1;j>=0;j--){ printf("%d",num[j]); } return 0; }
要注意A+B是0,0的任何进制都是0
标签:pat,进制,1022,int,乙级,num,include From: https://www.cnblogs.com/Npc-Hb/p/17176463.html