返回小组 开始 2021-08-08 09:00:00

202108第一轮测试(J)

结束 2021-08-08 11:30:00
Contest is over.
当前 2024-09-20 06:20:11

数字游戏怎么做

lczl  •  3年前

include<stdio.h>

include

include

using namespace std; int main() {

int n,k,S;
scanf("%d %d",&n,&k);
S=n;
while(S<k)
{
	n++;
	S=S+n;
	if(S==k)
	{
		printf("%d",n);
	}
	else if(S>k)
	{
		printf("%d",n-1);
	}
}
return 0;

}


guojunkai  •  3年前

谢谢爸爸


lczl  •  3年前

比赛已结束。