#abc220c. C - Long Sequence
C - Long Sequence
Score : points
问题描述
我们有一个包含 个正整数的序列:。
令 为 的重复串联,重复次数为 次。
从左至右计算序列 中各项之和。何时和首次超过 ?
换句话说,找到满足以下条件的最小整数 :
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
We have a sequence of positive integers: .
Let be the concatenation of copies of .
Consider summing up the terms of from left to right. When does the sum exceed for the first time?
In other words, find the minimum integer such that:
.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3
3 5 2
26
Sample Output 1
8
We have .
holds, but the condition is not satisfied when is or less, so the answer is .
Sample Input 2
4
12 34 56 78
1000
Sample Output 2
23
update @ 2024/3/10 09:43:13