PAT 1027 Colors in Mars

#include<iostream>
using namespace std;

int main()
{
	char a[13] = {'0','1','2','3','4','5','6','7','8','9','A','B','C'};
	int num;
	int tmp;
	for(int i=0; i<3; ++i)
	{
		cin>>num;
		if(!i)
			cout<<"#";
		tmp = num / 13;
		cout<<a[tmp];
		tmp = num % 13;
		cout<<a[tmp];
	}
	cout<<endl;
	return 0;
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章