17青岛区域赛

6 篇文章 0 订阅

链接:https://nanti.jisuanke.com/acm?kw=ACM-ICPC%202017%20Asia%20Qingdao

B(模拟)

像#一样3个一个字母就输出那个字母

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;

char ans;
string a[3];

int main(){
	int t,ok;
	scanf("%d",&t);
	while(t--){
		//getchar();
		for(int i = 0;i<3;++i){
				cin>>a[i];
		}
		ok = 0;
		for(int i = 0;i<3;++i){
			for(int j = 0;j<3;++j){
				if(i != 0&&j != 0)
				continue;
				if(i == 0&&j == 0){
					if(a[i][j] == a[i+1][j+1] && a[i+1][j+1]== a[i+2][j+2] && a[i][j] != '.'){
				//		cout<<"1\n";
						ok = 1;
						ans = a[i][j];
						break;
					}
				}
				if(i == 0&&j == 2){
					if(a[0][2] == a[1][1] &&a[1][1]== a[2][0] && a[i][j] != '.'){
				//		cout<<"2\n";
						ok = 1;
						ans = a[i][j];
						break;
					}
				}
				if(i == 0){
					if(a[i][j] == a[i+1][j] &&a[i+1][j] == a[i+2][j] && a[i][j] != '.'){
					//	cout<<"3\n";
						ok = 1;
						ans = a[i][j];
						break;
					}
				}
				if(j == 0){
					if(a[i][j] == a[i][j+1] &&a[i][j+1] == a[i][j+2] && a[i][j] != '.'){
					//	cout<<"4\n";`
						ok = 1;
						ans = a[i][j];
						break;
					}
				}
			}
			if(ok == 1)
			break;
		}
		if(ok == 1)
		cout<<ans<<endl;
		else
		cout<<"ongoing\n";
	}
	return 0;
}

I The Squared Mosquito Coil

题意:画圈圈图

dfs

     l = 0;
        num = 1;
        memset(visit, false, sizeof(visit));
        cin >> n;
        dfs(0, 0);//利用dfs走的结果把能走的位置标记为true
        int i;
        int j;
        for(i = 0; i < n; i++)//利用visit数组输出
        {
            for(j = 0; j < n; j++)
            {
                if(visit[i][j])
                {
                    cout << "#";
                }
                else
                {
                    cout << " ";
                }
            }
            cout << endl;
        }
    }
    return 0;
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值