跳到正文

题解

题解:P10291 [CCC 2024 J2] Dusa And The Yobis

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

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 1 分钟
题目
P10291

版本

  1. v1当前

我们已知 dd,那么我们可以一直读入 Yobi 的大小(设为 xx):

  • 当 x<dx < d,则让 d=d+td = d + t;
  • 当 x≥dx \ge d,直接输出 dd 即可。
C++
#include <iostream>
#define int long long
using namespace std;
signed main() {
	int d;
	cin >> d;
	while (1) {
		int t;
		cin >> t;
		if (d > t) d += t;
		else {
			cout << d;
			return 0;
		}
	}
}
原文