栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

SWERC 2021-2022 题解合集

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

SWERC 2021-2022 题解合集

预计是个大工程,慢慢补吧

M 不难想象构造000011111这样的序列即可,求一下0的最大值与1的最大值,加一起大于n不符合答案

#include 
using namespace std; 
int main()
{
int t;
cin>>t;
while(t--){
	int n,m;
	cin>>n>>m;int ma=0;int mb=0;
	for(int i=1;i<=m;i++){
		int a,b;
		cin>>a>>b;
		ma=max(a,ma);
		mb=max(b,mb);
	}
	if(ma+mb>n){
		printf("IMPOSSIBLEn");
		continue; 
	}
	for(int i=1;i<=ma;i++){
		printf("R");
	}
	for(int i=ma+1;i<=n;i++)printf("W");
	printf("n");
}	
 } 

O 考虑把一个平面的情况离散化一下,映照在一维为r,二维为度数的二维数组上

然后这个需要注意一下细节,考场其实想到了,代码能力低下,细节问题没考虑清楚

#import
#define endl 'n'
using namespace std;
int n,t,x,y,z,a[24][360],b[24][360],w[24][360];
char c;
string s;
void dfs(int x,int y)
{
	if(w[x][y])return;
	if(x>19)
	{
		s="YES";
		return;
	}
	w[x][y]=1;
	if(x&&!a[x-1][y])dfs(x-1,y);
	if(!a[x][y])dfs(x+1,y);
	if(!b[x][y])dfs(x,(y+359)%360);
	if(!b[x][(y+1)%360])dfs(x,(y+1)%360);
}//b[x][y]=0 cong x y-1 dao  x y 
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	for(cin>>t;t--;)
	{
		for(cin>>n;n--;)
		{
			cin>>c>>x>>y>>z;
			if(c=='C')
			{
				for(;y!=z;)
				{
					a[x-1][y]=1;
					++y%=360;
				}
			}//a 从x-1到x  
			if(c=='S')
			{
				for(;x 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/875643.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号