gold_boy_hetao @ 2024-07-17 21:41:00
大佬们救命呀!我要发癫了!!不会转进制呀!!!
#include <iostream>
using namespace std;
bool hw(int x)
{
int y = x,ans = 0;
while (y > 0)
{
ans *= 10;
ans += y % 10;
y /= 10;
}
if (x == ans)
return true;
else
return false;
}
int dgl(int x)
{
int ans = 0;
while (x > 0)
{
ans *= 10;
ans += x % 10;
x /= 10;
}
return ans;
}
int main()
{
int n,m;
cin >> n >> m;
for (int i = 1;i <= 30;i++)
{
int o = dgl(m);
if (hw(o + m))
{
cout << "STEP=" << i;
return 0;
}
}
cout << "Impossible!";
return 0;
}
菜鸡一枚,多多关照......
by Zhenghw @ 2024-07-18 21:58:33
这道题以n为底,操作时逢n进1
by Zhenghw @ 2024-07-18 22:00:56
如果你不会转换进制传送门