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 ...
随机推荐
- gradle 排除jar
排除fastjson的包,其他同理compile('com.qq.sdk:core:2.0.3') { exclude group: 'com.alibaba'}
- cannot find module node-sass
解决方法: npm install --save-dev node-sass
- javaScript的事件冒泡事件捕获
(1)冒泡型事件:事件按照从最特定的事件目标到最不特定的事件目标(document对象)的顺序触发. IE 5.5: div -> body -> document IE 6.0: div ...
- (1.1)学习笔记之mysql体系结构(内存、进程、线程)
关键词:mysql体系结构 参考:https://www.cnblogs.com/zhoubaojian/articles/7866292.html 一.mysql体系架构概述 1.mysql体系结构 ...
- tee - 从标准输入写往文件和标准输出
总览 (SYNOPSIS) tee [OPTION]... [FILE]... 描述 (DESCRIPTION) 把 标准输入 的 数据 复制到 每一个 文件 FILE, 同时 送往 标准输出. -a ...
- check all tables rows
select TABLE_NAME,NUM_ROWS from all_tables where OWNER='xx' order by NUM_ROWS desc;
- C++如何阻止一个类被实例化
(1)定义一个无用的抽象函数,使得类成为抽象类 (2)将构造函数定义为private. 为什么要这样做? 一些工具类,没有被实例化的必要.
- CSIC_716_20191209【并发编程---GIL和协程】
GIL Global Interpreter Lock 全局解释锁 GIL对含IO的任务来说,会出现不能保证数据安全的情况.如下: from threading import Thread fro ...
- vue全家桶(vue2.x+vue-router+axios+webpack)项目搭建
参考博客文章 博主FungLeo的Vue2+VueRouter2+Webpack+Axios 构建项目实战2017重制版 注:原博主写的非常详细 本文章为根据原博主教程总结的自己的搭建流程 一.安装n ...
- HTML5 原生API input file 来实现多图上传,并大图预览
闲来无事,突然想用原生来实现图片的多图上传. 一.效果图大致如下: 1.上传时可以选择多图 2.上传之后缩略图下过图如下: 3.点击缩略图,大图展示当前所点击的图片,并可以左右滑动查看其它的缩略图对应 ...