比赛链接:AtCoder Beginner Contest 395
A-Strictly Increasing
思路:模拟即可。时间复杂度 O(n) 可以通过此题。
#include <bits/stdc++.h>
#define endl '\n'
#define rep(i, a, n) for (int i = a; i <= n; i++)
#define per(i, n, a) for (int i = n; i >= a; i--)
#define LL long long
#define fir first
#define sec second
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
using namespace std;
void solve()
{
int n;
cin >> n;
vector<int>a(n+5,0);
rep(i,1,n)
cin >> a[i];
rep(i,2,n)
{
if(a[i]<=a[i-1])
{
cout << "No" << endl;
return;
}
}
cout << "Yes" << endl;
}
int main()
{
IOS;
int t;
//cin >> t;
t=1;
while (t--)
{
solve();
}
return 0;
}
B-Make Targ
思路:题目讲得很清楚了,模拟即可。 时间复杂度 O(n^3) 可以通过此题。
#include <bits/stdc++.h>
#define endl '\n'
#define rep(i, a, n) for (int i = a; i <= n; i++)
#define per(i, n, a) for (int i = n; i >= a; i--)
#define LL long long
#define fir first
#define sec second
#define IOS \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
using namespace std;
char a[55][55];
void solve()
{
int n;
c

最低0.47元/天 解锁文章
&spm=1001.2101.3001.5002&articleId=146000489&d=1&t=3&u=b6533b48e08b48b5aef5e202a77a4819)
962

被折叠的 条评论
为什么被折叠?



