Codeforces - 1191B - Tokitsukaze and Mahjong - 模拟
https://codeforces.com/contest/1191/problem/B
小心坎张听的情况。
#include<bits/stdc++.h>
using namespace std;
string s[3];
int main() {
#ifdef Yinku
freopen("Yinku.in", "r", stdin);
//freopen("Yinku.out", "w", stdout);
#endif // Yinku
while(cin >> s[0] >> s[1] >> s[2]) {
if(s[0] == s[1] && s[1] == s[2]) {
//刻子
puts("0");
} else if(s[0] == s[1] || s[0] == s[2] || s[1] == s[2]) {
puts("1");
} else {
//顺子
int cntm = 0, cntp = 0, cnts = 0;
for(int i = 0; i < 3; i++) {
if(s[i][1] == 'm')
cntm++;
else if(s[i][1] == 'p')
cntp++;
else
cnts++;
}
if(cntm == 3 || cntp == 3 || cnts == 3) {
sort(s, s + 3);
int lx = 0;
if(abs(s[0][0] - s[1][0]) == 1)
lx++;
if(abs(s[1][0] - s[2][0]) == 1)
lx++;
if(lx)
printf("%d\n", 2 - lx);
else {
if(abs(s[0][0] - s[1][0]) == 2)
lx++;
if(abs(s[1][0] - s[2][0]) == 2)
lx++;
puts(lx ? "1" : "2");
}
} else if(cntm == 1 && cntp == 1 && cnts == 1) {
puts("2");
} else {
char c = 'm';
if(cntp == 2)
c = 'p';
else if(cnts == 2)
c = 's';
vector<string> vs;
for(int i = 0; i < 3; i++) {
if(s[i][1] == c)
vs.push_back(s[i]);
}
if(abs(vs[0][0] - vs[1][0]) <= 2) {
puts("1");
} else {
puts("2");
}
}
}
}
}
Codeforces - 1191B - Tokitsukaze and Mahjong - 模拟的更多相关文章
- Codeforces 1191B Tokitsukaze and Mahjong
题目链接:http://codeforces.com/problemset/problem/1191/B 题意:类似于麻将,三个一样花色一样数字的,或者三个同花顺就赢了,新抽的能当任何类型,问至少几个 ...
- Codeforces Round #573 (Div. 2) Tokitsukaze and Mahjong 水题
B. Tokitsukaze and Mahjong time limit per test1 second memory limit per test256 megabytes Tokitsukaz ...
- CodeForces.158A Next Round (水模拟)
CodeForces.158A Next Round (水模拟) 题意分析 校赛水题的英文版,坑点就是要求为正数. 代码总览 #include <iostream> #include &l ...
- [Codeforces 1191D] Tokitsukaze, CSL and Stone Game(博弈论)
[Codeforces 1191D] Tokitsukaze, CSL and Stone Game(博弈论) 题面 有n堆石子,两个人轮流取石子,一次只能从某堆里取一颗.如果某个人取的时候已经没有石 ...
- Codeforces - 1191C - Tokitsukaze and Discard Items - 模拟
https://codeforces.com/contest/1191/problem/C 一开始想象了一下,既然每次删除都是往前面靠,那么好像就是页数*页容量+空位数=最多容纳到的坐标. 至于为什么 ...
- [模拟] Codeforces - 1191C - Tokitsukaze and Discard Items
Tokitsukaze and Discard Items time limit per test 1 second memory limit per test 256 megabytes input ...
- Codeforces 747C:Servers(模拟)
http://codeforces.com/problemset/problem/747/C 题意:有n台机器,q个操作.每次操作从ti时间开始,需要ki台机器,花费di的时间.每次选择机器从小到大开 ...
- Codeforces 740A. Alyona and copybooks 模拟
A. Alyona and copybooks time limit per test: 1 second memory limit per test: 256 megabytes input: st ...
- Codeforces 716A Crazy Computer 【模拟】 (Codeforces Round #372 (Div. 2))
A. Crazy Computer time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...
随机推荐
- V7双雄-基于Virtex7XC7VX690T的高性能计算板卡解决方案
北京太速V7双雄-基于Virtex7XC7VX690T的高性能计算板卡
- hadoop HA + HBase HA搭建:
hadoop HA搭建参考:https://www.cnblogs.com/NGames/p/11083640.html (本节:用不到YARN 所以可以不用考虑部署YARN部分) Hadoop 使用 ...
- gevent简介
gevent是基于协程的Python网络库. 协程存在的意义:对于多线程应用,CPU通过切片的方式来切换线程间的执行,线程切换时需要耗时(保存状态,下次继续).协程,则只使用一个线程,在一个线程中规定 ...
- join 按两个文件的相同字段合并
1.命令功能 join对每一对具相同内容的输入行,合并为一行输出.默认情况是把输入的第一个字段作为连接字段,字段间用空格隔开. 2.语法格式 join option file1 file2 jo ...
- sed \s
export m1=`free|cut -d ":" -f2|sed -e "s/^\s\s*//g"|head -2|tail -1|cut -d ' ' - ...
- 线程工具类 - CyclicBarrier(循环栅栏)
CyclicBarrier官方文档 一.原理 CyclicBarrier是另外一种多线程并发控制实用工具.它和CountDownLatch非常类似,它也可以实现线程的计数等待,但它的功能比CountD ...
- tensorflow函数介绍 (5)
1.tf.ConfigProto tf.ConfigProto一般用在创建session的时候,用来对session进行参数配置: with tf.Session(config=tf.ConfigPr ...
- Influxdb根据配置文件启动(Influxdb的数据存储)
1.在Influxdb文件夹下建立一个bat文件 2.文件内容如下: @echo offSETLOCAL :: 获取当前批处理所在路径SET InfluxdP==%~dp0 :: 开启influxdb ...
- Reporting Services 配置工具
使用 Reporting Services 配置管理器可配置 Reporting Services 安装.如果使用“仅文件”选项安装报表服务器,则必须使用此工具来配置服务器,才能使用该服务器.如果使用 ...
- 我眼中的CentOS 下 安全策略
安全策略 ===================== 1.每个人用自己名字的账户和密码登陆服务器(便于追踪用户操作,记录用户行为)2.只允许指定组(或用户)使用sudo命令(最好还要禁止root用户远 ...