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 ...
随机推荐
- freemark 语法
我们通过后端model. addAttribute() 传递到前端的值来进行界面渲染 它的循环语句 和其他的有点不同: if 循环 <#if 条件语句> </#if> if ...
- The Preliminary Contest for ICPC Asia Shenyang 2019 H
H. Texas hold'em Poker 思路:根据每个牌型分等级,然后排序按照等级优先,最大值次之,次大值,最后比较剩下值的和. #include<bits/stdc++.h> us ...
- 力扣算法题—143ReorderList
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You may not mod ...
- 热修复设计之CLASS_ISPREVERIFIED(二)
阿里P7移动互联网架构师进阶视频(每日更新中)免费学习请点击:https://space.bilibili.com/474380680本篇文章将继续从CLASS_ISPREVERIFIED实战来介绍热 ...
- OpenGL中的空间变换
OpenGL中的空间变换 在使用OpenGL的三维虚拟程序中.当我们指定了模型的顶点之后.在屏幕上显示它们之前,一共会发生3种类型的变换:视图变换.模型变换.投影变换. ...
- linux系统:go build报错import cycle not allowed
go build 困扰我多时的 go 编译报错:循环导入,代码肯定是没问题的,网上查说重新安装go 我觉得也不是太好的办法 import cycle not allowed package day01 ...
- CSS和jQuery分别实现图片无缝滚动效果
一.效果图 二.使用CSS实现 <!DOCTYPE html> <html> <head> <meta charset="utf-8"&g ...
- postgresql 备份数据库结构
--只备份结构pg_dump -U postgres -d grgzpt -f D:\dump.sql -s --备份结构和数据pg_dump -U postgres -d grgzpt -f D:\ ...
- Gym 102028J 扫描线/二维差分 + 解方程
题意:有一个二维平面,以及n个操作,每个操作会选择一个矩形,使得这个二维平面的一部分被覆盖.现在你可以取消其中的2个操作,问最少有多少块地方会被覆盖? 思路:官方题解简洁明了,就不细说了:https: ...
- 【读书笔记】C/C++程序员面试秘籍
第一章 C/C++ 程序基础(共12题) 第二章 预处理.const.static.和 sizeof(共27题) 第三章 引用和指针(共39题) 第四章 字符串(共31题) 第五章 位运算与嵌入式编程 ...