题目链接:https://iai.sh.cn/problem/414。
代码:
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int n, i;
char s[15];
int main()
{
cin >> n;
if (n == 0)
{
cout << 0 << endl;
return 0;
}
for (; n; i++)
{
if (n % 3 == 1)
{
s[i] = '1';
n /= 3;
}
else if (n % 3 == 2)
{
s[i] = 'z';
n = n / 3 + 1;
}
else
{
s[i] = '0';
n /= 3;
}
}
for (i--; i >= 0; i--)
cout << s[i];
cout << endl;
return 0;
}
你也没跟我说 Ctrl+Shift+W 是打开浏览器隐藏空间的快捷键啊!!!