跳到正文

题解

P10291 [CCC 2024 J2] Dusa And The Yobis tj

_colin1112_约 1 分钟
原文
文章信息与版本

文章信息

发布
2024年3月30日
收录
2025年12月12日
更新
2026年11月14日
篇幅
约 1 分钟
题目
P10291

版本

  1. v1当前

思路

首先输入 Dusa 的身高,然后使用 while 循环输入 Yobi 的身高,如果 Dusa 身高 ≤\leq Yobi 的身高,那么跳出循环结束程序,否则 Dusa 与 Yobi 身高相加,进入下一次循环。

Code

C++
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'

using namespace std;
const int E=1e6+5;
ll d;
ll x;
int main(){
	cin >>d;
	while(cin >>x){
		if(x>=d)break;
		d+=x;
	}
	cout <<d;
	return 0;
}
原文