A1026简直了,要是考到当场弃考走人,有位仁兄竟然写了400行,我才不干……
找了个还不错的参考答案:(那我也不复现)大佬答案
A1027……幼儿园水平
#include<iostream>
#include<string>
using namespace std;
string color = "0123456789ABC";
void trans(int a)
{
int s1 = a / 13;
int s2 = a % 13;
cout << color[s1] << color[s2];
}
int main()
{
int r, g, b;
scanf("%d %d %d", &r, &g, &b);
int org[3] = { r,g,b };
cout << "#";
for (int i = 0; i < 3; i++)
{
if (org[i] <= 12)
cout << "0" << color[org[i]];
else
trans(org[i]);
}
return 0;
}