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 - 模拟的更多相关文章

  1. Codeforces 1191B Tokitsukaze and Mahjong

    题目链接:http://codeforces.com/problemset/problem/1191/B 题意:类似于麻将,三个一样花色一样数字的,或者三个同花顺就赢了,新抽的能当任何类型,问至少几个 ...

  2. Codeforces Round #573 (Div. 2) Tokitsukaze and Mahjong 水题

    B. Tokitsukaze and Mahjong time limit per test1 second memory limit per test256 megabytes Tokitsukaz ...

  3. CodeForces.158A Next Round (水模拟)

    CodeForces.158A Next Round (水模拟) 题意分析 校赛水题的英文版,坑点就是要求为正数. 代码总览 #include <iostream> #include &l ...

  4. [Codeforces 1191D] Tokitsukaze, CSL and Stone Game(博弈论)

    [Codeforces 1191D] Tokitsukaze, CSL and Stone Game(博弈论) 题面 有n堆石子,两个人轮流取石子,一次只能从某堆里取一颗.如果某个人取的时候已经没有石 ...

  5. Codeforces - 1191C - Tokitsukaze and Discard Items - 模拟

    https://codeforces.com/contest/1191/problem/C 一开始想象了一下,既然每次删除都是往前面靠,那么好像就是页数*页容量+空位数=最多容纳到的坐标. 至于为什么 ...

  6. [模拟] Codeforces - 1191C - Tokitsukaze and Discard Items

    Tokitsukaze and Discard Items time limit per test 1 second memory limit per test 256 megabytes input ...

  7. Codeforces 747C:Servers(模拟)

    http://codeforces.com/problemset/problem/747/C 题意:有n台机器,q个操作.每次操作从ti时间开始,需要ki台机器,花费di的时间.每次选择机器从小到大开 ...

  8. Codeforces 740A. Alyona and copybooks 模拟

    A. Alyona and copybooks time limit per test: 1 second memory limit per test: 256 megabytes input: st ...

  9. 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 ...

随机推荐

  1. 认知redis

    一.redis是什么? 1.基于key-value的内存No sql 数据库(非关系型数据库) 2.读写性能非常好 二.redisd的数据类型有哪些?特点分别是什么? 1)string 一个键对一个值 ...

  2. C# 给DataTable去重

    using System; using System.Data; namespace DelegateTest { public class Program { public static void ...

  3. 本地主机访问远程linux系统服务器上的jupyter notebook

    1,机器情况:服务器 centos python环境已经配置好了,在虚拟环境下安装了anaconda 并且在里面安装了jupyter notebook 2,主机是 windows     ipytho ...

  4. ls 显示目录下的内容和文件相关属性信息

    1.命令功能 ls命令是“list directory contents”,显示当前目录下的内容和文件属性. 2.语法格式 ls  [option]  file ls  选项  文件名 3.选项说明 ...

  5. python-使用list和tuple

    list Python内置的一种数据类型是列表:list.list是一种有序的集合,可以随时添加和删除其中的元素. 比如,列出班里所有同学的名字,就可以用一个list表示: >>> ...

  6. [python 学习] sys模块

    sys.stdout sys.stdin

  7. sublime text3 Package Control 插件安装及推荐(MAC)

    参考: https://www.zhihu.com/question/36233553 https://www.cnblogs.com/zuoan-oopp/p/6692797.html 插件推荐 因 ...

  8. pypi 清华镜像使用帮助

    清华镜像 地址 https://mirrors.tuna.tsinghua.edu.cn/help/pypi/ 临时使用 pip install -i https://pypi.tuna.tsingh ...

  9. 关于python3 使用pycharm+unittest+html+HTMLTestRunner 测试用例运行正常,但却不能生成测试报告的解决方法

    关于python3 使用pycharm+unittest+html+HTMLTestRunner 测试用例运行正常,但却不能生成测试报告的解决方法 这个问题我也遇到过,以下是解决办法   该方法适用于 ...

  10. __getattr__属性查找

    from datetime import date """ __getattr__ : 在查找不到对象的属性时调用 __getattribute__ : 在查找属性之前调 ...