Codeforces 1191B Tokitsukaze and Mahjong
题目链接:http://codeforces.com/problemset/problem/1191/B


题意:类似于麻将,三个一样花色一样数字的,或者三个同花顺就赢了,新抽的能当任何类型,问至少几个。
思路:分类判断即可。
AC代码:
#include<bits/stdc++.h>
using namespace std;
bool check(int x,int y,int z)
{
if(x == (y + z) / && abs(y-z) == ) return true;
if(y == (x + z) / && abs(x-z) == ) return true;
if(z == (y + x) / && abs(y-x) == ) return true;
return false;
}
int main()
{
string a,b,c;
cin >> a >> b >> c;
int x = a[] - '';
int y = b[] - '';
int z = c[] - '';
if(a[] == b[] && b[] == c[])
{
if((x == y && y == z )|| check(x,y,z)) cout << << endl;
else if(abs(x-y) <= || abs(z-y) <= || abs(x-z) <= ) cout << << endl;
else cout << << endl;
}
else if(a[] == b[])
{
if(x == y || abs(x-y) <= ) cout << << endl;
else cout << << endl;
}
else if(b[] == c[])
{
if(z == y || abs(z-y) <= ) cout << << endl;
else cout << << endl;
}
else if(a[] == c[])
{
if(x == z || abs(x-z) <= ) cout << << endl;
else cout << << endl;
}
else cout << << endl;
return ;
}
Codeforces 1191B Tokitsukaze and Mahjong的更多相关文章
- Codeforces - 1191B - Tokitsukaze and Mahjong - 模拟
https://codeforces.com/contest/1191/problem/B 小心坎张听的情况. #include<bits/stdc++.h> using namespac ...
- Codeforces Round #573 (Div. 2) Tokitsukaze and Mahjong 水题
B. Tokitsukaze and Mahjong time limit per test1 second memory limit per test256 megabytes Tokitsukaz ...
- [Codeforces 1191D] Tokitsukaze, CSL and Stone Game(博弈论)
[Codeforces 1191D] Tokitsukaze, CSL and Stone Game(博弈论) 题面 有n堆石子,两个人轮流取石子,一次只能从某堆里取一颗.如果某个人取的时候已经没有石 ...
- Codeforces 1190C. Tokitsukaze and Duel
传送门 注意到后手可以模仿先手的操作,那么如果一回合之内没法决定胜负则一定 $\text{once again!}$ 考虑如何判断一回合内能否决定胜负 首先如果最左边和最右的 $0$ 或 $1$ 距离 ...
- Codeforces - 1191E - Tokitsukaze and Duel - 博弈论 - 尺取
https://codeforc.es/contest/1191/problem/E 参考自:http://www.mamicode.com/info-detail-2726030.html 和官方题 ...
- Codeforces - 1191F - Tokitsukaze and Strange Rectangle - 组合数学 - 扫描线
https://codeforces.com/contest/1191/problem/F 看了一下题解的思路,感觉除了最后一段以外没什么启发. 首先离散化x加快速度,免得搞多一个log.其实y不需要 ...
- Codeforces - 1191C - Tokitsukaze and Discard Items - 模拟
https://codeforces.com/contest/1191/problem/C 一开始想象了一下,既然每次删除都是往前面靠,那么好像就是页数*页容量+空位数=最多容纳到的坐标. 至于为什么 ...
- Codeforces 1190C Tokitsukaze and Duel game
题意:有一个长为n的01串,两个人轮流操作,每个人可以把某个长度为m的区间变成相同颜色,谁在操作后整个串颜色相同就赢了.问最后是谁赢?(有可能平局) 思路:容易发现,如果第一个人不能一击必胜,那么他就 ...
- Codeforces 1191A Tokitsukaze and Enhancement
题目链接:http://codeforces.com/problemset/problem/1191/A 思路:枚举 16 种情况输出最高的就行. AC代码: #include<bits/std ...
随机推荐
- Celery 'Getting Started' not able to retrieve results; always pending
参考 根据Celery的官方文档,当使用windows 10 64-bit, Python 2.7,Erlang 64-bit binary, RabbitMQ server and celery r ...
- Linux内核TSS的使用
参见文章:http://blog.chinaunix.net/uid-22695386-id-272098.html linux2.4之前的内核有进程最大数的限制,受限制的原因是,每一个进程都有自已的 ...
- log4j日志格式化
Apache log4j 提供了各种布局对象,每一个对象都可以根据各种布局格式记录数据.另外,也可以创建一个布局对象格式化测井数据中的特定应用的方法. 所有的布局对象 - Appender对象收到 L ...
- MFC 模块状态的实现
本技术备忘录介绍MFC “模块状态”结构的实现.充分理解模块状态这个概念对于在DLL中使用MFC的共享动态库是十分重要的. MFC的状态信息分为三种:全局模块状态数据.进程局部状态数据和线程局部状态数 ...
- zookeeper的监听
统一配置管理.统一命名服务.分布式锁.集群管理
- Emacs25.1之后UrlHttpError
Emacs25.1之后UrlHttpError */--> pre.src {background-color: #002b36; color: #839496;} pre.src {backg ...
- 写第一个 swift,iOS 8.0程序
class ViewController: UIViewController { @IBAction func btn_click(sender : AnyObject) { println(&quo ...
- 算法竞赛模板 KMP
KMP算法图解: ① 首先,字符串“BBC ABCDAB ABCDABCDABDE”的第一个字符与搜索词“ABCDABD”的第一个字符,进行比较.因为B与A不匹配,所以搜索词后移一位. ② 因为B与A ...
- window 下总是object_detection/protos/*.proto: No such file or directory
这是因为目前的protoc3.5有Bug,换成3.4就好了https://github.com/google/protobuf/releases/tag/v3.4.0
- iOS开发系列-Block
概述 在iOS 4.0之后,block横空出世,它本身封装了一段代码并将这段代码当做变量,通过block()的方式进行回调.这不免让我们想到在C函数中,我们可以定义一个指向函数的指针并且调用. #im ...