1027 Colors in Mars

代码如下:

 1 #include<iostream>
 2 #include<cstring>
 3 using namespace std;
 4 
 5 int main(){
 6     int a[3];
 7     string str = "#";
 8     cin >> a[0] >> a[1] >> a[2];
 9     for(int i = 0; i < 3; i++){
10         int stem = a[i]/13;
11         int stem1 = a[i]%13;
12         if(stem < 10){
13             str.insert(str.end(),stem+'0');
14         }
15         else{
16             str.insert(str.end(),(stem-10)+'A');
17         }
18         if(stem1 < 10){
19             str.insert(str.end(),stem1+'0');
20         }
21         else{
22             str.insert(str.end(),(stem1-10)+'A');
23         }
24     }
25     cout << str;
26     return 0;
27 
28 }

 

posted @ 2018-10-08 16:36  琥琥笙威  阅读(92)  评论(0编辑  收藏  举报