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 ...
随机推荐
- TensorFlow——实现线性回归算法
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt #使用numpy生成200个随机点 x_data= ...
- Oracle Grid,ASM,Database on Redhat 7.5
目录 Oracle安装包 Oracle官方文档 Blog Oracle Grid Installation Process 用户.组.目录 Oracleasm 创建 ASM 磁盘 Database S ...
- NLP 中 Attention Model 解析
Attention Model,简称AM模型,本文只谈文本领域的AM模型,其实图片领域AM的机制也是相同的. 目前绝大多数文献中出现的AM模型是附着在Encoder-Decoder框架下的,但是其实A ...
- java并发学习--第一章 线程的创建
所谓的并发就是指一个时间段中有几个程序都处于已启动运行到运行完毕之间,且这几个程序都是在同一个处理机上运行,但任一个时刻点上只有一个程序在处理机上运行.所以我们看似几个线程在同时进行,其实在操作系统中 ...
- [HYSBZ - 3252] 攻略
问题描述 题目简述:树版[k取方格数] 众所周知,桂木桂马是攻略之神,开启攻略之神模式后,他可以同时攻略k部游戏.今天他得到了一款新游戏<XX 半岛>,这款游戏有n个场景(scene),某 ...
- 英语单词debug
来源——docker官网首页https://www.docker.com/ 翻译 vt. 调试,排除故障,除错,改正有毛病部分 过去式 debugged 过去分词 debugged 现在分词 debu ...
- Word文档粘贴到帝国CMS
很多时候我们用一些管理系统的时候,发布新闻.公告等文字类信息时,希望能很快的将word里面的内容直接粘贴到富文本编辑器里面,然后发布出来.减少排版复杂的工作量. 下面是借用百度doc 来快速实现这个w ...
- properties与yml之间的比较
在Spring Cloud的配置文件中,发现使用yml与properties两种后缀的文件: 在application.properties中内容是这样的: server.port=8801eurek ...
- 阿里云数据库导出-本地mysql导入
因阿里云数据库标准访问模式不支持外网接入 因此导出一份到本地,注意选择编码为utf8 mysql 命令行用source导入有utf8编码的sql文件时导入的数据有乱码解决办法 set names ut ...
- JS replace方法
var str = '1abc2defg3hijk'; str.replace(/\d/g,function(a,b,c,d){ console.log("a:",a);// 匹配 ...