当前位置:网站首页>AcWing 1725. 组队井字游戏(枚举)
AcWing 1725. 组队井字游戏(枚举)
2022-04-21 10:38:00 【岁忧】
题目:1725. 组队井字游戏


题解:枚举每一种情况。然后用set来解决重复的问题。一维set用来解决字符重复的问题。二维set用来解决满足要求的组合里重复的问题。
#include<bits/stdc++.h>
#define x first
#define y second
using namespace std;
typedef long long LL;
typedef pair<int ,int> PII;
const int N=1e5+10;
const int mod=100000007;
char a[5][5];
int main(){
for(int i=0;i<3;i++)
cin>>a[i];
set<set<char>> st[2];
for(int i=0;i<3;i++){
set<char> t;
for(int j=0;j<3;j++){
t.insert(a[i][j]);
}
if(t.size()==1) st[0].insert(t);
else if(t.size()==2) st[1].insert(t);
}
for(int i=0;i<3;i++){
set<char> t;
for(int j=0;j<3;j++){
t.insert(a[j][i]);
}
if(t.size()==1) st[0].insert(t);
else if(t.size()==2) st[1].insert(t);
}
set<char> t;
for(int i=0;i<3;i++){
t.insert(a[i][i]);
}
if(t.size()==1) st[0].insert(t);
else if(t.size()==2) st[1].insert(t);
t.clear();
for(int i=0;i<3;i++){
t.insert(a[2-i][i]);
}
if(t.size()==1) st[0].insert(t);
else if(t.size()==2) st[1].insert(t);
cout<<st[0].size()<<endl<<st[1].size();
return 0;
}
版权声明
本文为[岁忧]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_46028214/article/details/124313038
边栏推荐
- UVM和SystemVerilog中的返回值使用方法
- Android learning ① various reasons why Android cannot connect to MySQL database and Solutions
- 看完这篇 教你玩转渗透测试靶机vulnhub——DC9
- Showcase时手机不够怎么办? 云真机平台atxserver2
- JS初练——弹弹球与墙壁碰撞处理实例
- L1-045 宇宙无敌大招呼 (5 分)
- Oracle密码过期问题,设置永不过期
- L1-053 电子汪 (10 分)
- Local IP addresses are accessed using domain names
- L1-050 倒数第N个字符串 (15 分)
猜你喜欢

SAP ABAP FOR ALL ENTRIES 的用法

Android学习 ① Android连接不上Mysql数据库的多种原因以及解决方式

24 pictures to conquer border image

Design a high-quality API interface

SQL: SQL file of tree three-tier occupational classification table
![2022信息与未来预备刷题4《New Online Judge 2034: [蓝桥杯2022初赛] 修剪灌木》](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
2022信息与未来预备刷题4《New Online Judge 2034: [蓝桥杯2022初赛] 修剪灌木》

设计一个高质量的 API 接口

Postman setting environment variables is simple and practical

torch. autograd. Function customization

Pytorch梯度检查 torch.autograd.gradcheck
随机推荐
Wxml template syntax - data binding
Construction of mobile communication platform (voice visual screen, sending and receiving SMS)
Showcase时手机不够怎么办? 云真机平台atxserver2
Leetcode 110 Balanced binary tree (2022.04.20)
A collection of econometric models and empirical Stata codes, with top publication examples
伦敦金在哪里开户安全?
How to write product requirements document (PRD) with the idea of five elements of user experience
最通俗易懂的依赖注入与控制反转
(SIP-1-话机注册)关于IP话机通过SIP协议注册到PBX电话交换机的全过程解析-如何看wireshark中的报文
比SQL还好用,又一门国产数据库语言诞生了
力扣(LeetCode)110. 平衡二叉树(2022.04.20)
C#入门-并行编程
Cisco Packet Tracer实验集合
SAP ABAP FOR ALL ENTRIES 的用法
Mysql 002 DDL
Sum of two numbers
计量模型、实证stata代码合集,附顶刊示例
Read the meaning of seek tiger's launch of Genesis node
2022信息与未来预备刷题1《New Online Judge 1112: 平面分割》
HMS Core 6.4.0版本发布公告