考察查询表以及求余分位
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34#include<iostream> #include<vector> char g_CharTable[13] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C'}; void OutPutIntVector(const std::vector<int>& a) { int size = (int)a.size(); for(int i = 0; i < size; ++i) { printf("%c", g_CharTable[a[i]]); } printf("n"); } void Convert2MarsColor(int r, int g, int b, std::vector<int>& color) { color.assign(6, 0); color[1] = r%13; color[0] = r/13; color[3] = g%13; color[2] = g/13; color[5] = b%13; color[4] = b/13; } int main() { int r, g, b; while(scanf("%d%d%d", &r, &g, &b) != EOF) { std::vector<int> color; Convert2MarsColor(r, g, b, color); printf("#"); OutPutIntVector(color); } return 0; }
最后
以上就是慈祥啤酒最近收集整理的关于1027. Colors in Mars (20)的全部内容,更多相关1027.内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复