题目描述
题目分析
对于本题遵循多了就减少了就加的原则,用while进行计算即可
#include<bits/stdc++.h>
using namespace std;
int x, ans;
int main()
{
while(x != 1)
{
if(x < 1)x += 97;
else x -= 127;
ans ++;
}
cout << ans;
return 0;
}
对于本题遵循多了就减少了就加的原则,用while进行计算即可
#include<bits/stdc++.h>
using namespace std;
int x, ans;
int main()
{
while(x != 1)
{
if(x < 1)x += 97;
else x -= 127;
ans ++;
}
cout << ans;
return 0;
}