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. 1146. Topological Order (25)

    This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topol ...

  2. php 输出缓冲

    <?php ob_start();//开启php输出缓冲区 echo "A"; //"A"会进入php输出缓冲区 ob_flush();//将php输出缓 ...

  3. windows下laravel 快速安装

    1. 安装composer  https://getcomposer.org/ 2. 安装git windows 客户端工具 https://git-scm.com/downloads 3. 更改co ...

  4. prototype的用法

    定义: prototype 属性使您有能力向对象添加属性和方法. 语法: object.prototype.name=value 实例: function prot(){ this.name = 'J ...

  5. redis专题

    1.Linux安装redis 2.redis持久化 3.redis配置 4.SpringBoot整合Redis发布订阅 5.redis事务 5.1.redis事务介绍 5.2. redisTempla ...

  6. oracle 11g 执行先决条件检查失败的解决方法

    在安装oracle 11g时,出现执行先决条件失败的情况如下: 你可以忽略所有强制安装,一般不会影响功能,但如果你想知道为什么会产生这种错误, 并且当出现以上情况时又该如何解决呢?如下列出了原因和解决 ...

  7. ES6基本用法

    es6是JS(JavaScript)的下一个版本. 新增了let命令,用来声明变量.变量在第一个花括号内有用,先声明后引用.不允许重复声明.存在暂时性死区. const声明一个只读的常量.一旦声明,常 ...

  8. BZOJ 3306: 树 LCT + set 维护子树信息

    可以作为 LCT 维护子树信息的模板,写的还是比较优美的. 本地可过,bzoj 时限太紧,一直 TLE #include<bits/stdc++.h> #define setIO(s) f ...

  9. Xenu Link Sleuth 简单好用的链接测试工具

    XenuLink Sleuth 名词介绍 “Xenu链接检测侦探”是被广泛使用的死链接检测工具.可以检测到网页中的普通链接.图片.框架.插件.背景.样式表.脚本和java程序中的链接. 那么神马时候出 ...

  10. 《Javascript设计模式与开发实践》关于设计模式典型代码的整理:单例模式、策略模式、代理模式、迭代器模式、发布-订阅模式、命令模式、组合模式

    1.单例模式:保证一个类仅有一个实例,并提供一个访问它的全局访问点. 使用闭包封装私有变量// 使用闭包创建单例var user = (function () { var _name = 'sven' ...