蓝桥杯每日一题2023.12.5

题目描述

1.一步之遥 – 蓝桥云课 (lanqiao.cn)

题目分析 

对于本题遵循多了就减少了就加的原则,用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;
}

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
青葱年少的头像青葱年少普通用户
上一篇 2023年12月6日
下一篇 2023年12月6日

相关推荐