题解:P12600 连号子序列数
P12600 连号子序列数题解
根据题意,我们要求关于
思路
通过分析,我们可以发现无论给定
注意使用 long long。
代码
#include<bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin >> n;
cout << n * (n + 1) / 2;
// 读取输入,但不需要处理
for (int i = 1; i <=n; ++i) {
int x;
cin >> x;
}
return 0;
}
这种方法的时间复杂度为
尝试只输入数字