PAT (Advanced Level) 1027. Colors in Mars (20)

Posted Fighting Heart

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PAT (Advanced Level) 1027. Colors in Mars (20)相关的知识,希望对你有一定的参考价值。

简单题。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;

void pri(int a)
{
    if (a <= 9) printf("%d", a);
    else printf("%c", a-10+A);
}

void print(int a){
    if (a >= 13) { pri(a/13);  pri(a%13);}
    else { printf("0"); pri(a); }
}
int main()
{
    int r, g, b;
    scanf("%d%d%d", &r, &g, &b);
    printf("#");
    print(r); print(g); print(b);
    printf("\n");
    return 0;
}

 

以上是关于PAT (Advanced Level) 1027. Colors in Mars (20)的主要内容,如果未能解决你的问题,请参考以下文章

PAT (Advanced Level) 1025. PAT Ranking (25)

PAT Advanced Level 1044

PAT Advanced Level 1043

PAT Advanced Level 1079

PAT Advanced Level 1095

PAT Advanced Level 1038