1027. Colors in Mars

C++语言: Codee#25889
01 /*
02 +++++++++++++++++++++++++++++++++++++++
03                 author: chm
04 +++++++++++++++++++++++++++++++++++++++
05 */
06
07 #include <map>
08 #include <set>
09 #include <list>
10 #include <queue>
11 #include <cmath>
12 #include <stack>
13 #include <bitset>
14 #include <cstdio>
15 #include <cctype>
16 #include <string>
17 #include <vector>
18 #include <cassert>
19 #include <cstdlib>
20 #include <cstring>
21 #include <fstream>
22 #include <sstream>
23 #include <iomanip>
24 #include <iostream>
25 #include <algorithm>
26
27 using namespace std;
28
29 FILE*            fin         = stdin;
30 FILE*            fout         = stdout;
31 const int        max_size     = 10086;
32 void printnum(int x)
33 {
34     if(x <= 9)
35         printf("%d", x);
36     else
37         printf("%c", x - 10 + 'A');
38 }
39 void run(int num)
40 {
41     int d1 = num / 13;
42     int d2 = num % 13;
43     printnum(d1);
44     printnum(d2);
45 }
46 #define ONLINE_JUDGE
47 int main()
48 {
49 #ifndef ONLINE_JUDGE
50     freopen("d:\\in.txt", "r", stdin);
51     freopen("d:\\out.txt", "w", stdout);
52 #endif
53     int red, green, blue;
54     scanf("%d%d%d", &red, &green, &blue);
55     printf("#");
56     run(red);
57     run(green);
58     run(blue);
59     printf("\n");
60
61
62
63 #ifndef ONLINE_JUDGE
64     fclose(stdout);
65     system("start d:\\check.exe d:\\out.txt d:\\ans.txt");
66 #endif
67     return 0;
68 }

原文地址:https://www.cnblogs.com/invisible/p/2408769.html