CodeForces 1004B Sonya and Exhibition(思维)

题目链接:CodeForces 1004B Sonya and Exhibition
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
我们保证每个区间的价值最大就可以了。
在这里插入图片描述
当且仅当 a=b 等号成立。(和相等,越接近,积越大)

然后我就进行了一系列骚操作,wrong answer on test 4 !! 思路不对,自己想复杂了

搜题解:也就是0 1均匀分布就可以QAQ,即交替输出0 1

#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>

using namespace std;
typedef long long ll;
const int maxn = 1010;
const int INF = 0x3f3f3f3f;
int a[maxn];

int main()
{
	int n,m,l,r;
	scanf("%d%d",&n,&m);
	
	for(int i=1;i<=m;i++)
		scanf("%d%d",&l,&r);
		
	for(int i=1;i<=n;i++)
		printf("%d",i%2);
	
	return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_42815188/article/details/89815958
今日推荐