PAT 天梯赛 L1-019. 谁先倒 【水】
题目链接
https://www.patest.cn/contests/gplt/L1-019
AC代码
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <cstdlib>
#include <ctype.h>
#include <numeric>
#include <sstream>
using namespace std;
typedef long long LL;
const double PI = 3.14159265358979323846264338327;
const double E = 2.718281828459;
const double eps = 1e-6;
const int MAXN = 0x3f3f3f3f;
const int MINN = 0xc0c0c0c0;
const int maxn = 1e5 + 5;
const int MOD = 1e9 + 7;
int main()
{
int arr[2] = {0};
cin >> arr[0] >> arr[1];
int q = arr[0], w = arr[1];
int n;
cin >> n;
int a, b, c, d;
int flag = 1;
while (n--)
{
scanf("%d%d%d%d", &a, &b, &c, &d);
if (flag)
{
if (a + c == b && a + c != d)
{
arr[0]--;
if (arr[0] < 0)
flag = 0;
}
if (a + c == d && a + c != b)
{
arr[1]--;
if (arr[1] < 0)
flag = 0;
}
}
else
continue;
}
if (arr[0] < 0)
printf("A\n%d\n", w - arr[1]);
else
printf("B\n%d\n", q - arr[0]);
}
PAT 天梯赛 L1-019. 谁先倒 【水】的更多相关文章
- PAT 天梯赛 L1-036. A乘以B 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-036 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L1-018. 大笨钟 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-018 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L1-013. 计算阶乘和 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-013 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L1-026. I Love GPLT 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-026 AC代码 #include <iostream> #include <cstdio&g ...
- PAT 天梯赛 L1-037. A除以B 【水】
题目链接 https://www.patest.cn/contests/gplt/L1-037 AC代码 #include <iostream> #include <cstdio&g ...
- PAT天梯赛 L1-049 天梯赛座位分配
题目链接:点击打开链接 天梯赛每年有大量参赛队员,要保证同一所学校的所有队员都不能相邻,分配座位就成为一件比较麻烦的事情.为此我们制定如下策略:假设某赛场有 N 所学校参赛,第 i 所学校有 M[i] ...
- PAT天梯赛L3-007 天梯地图
题目链接:点击打开链接 本题要求你实现一个天梯赛专属在线地图,队员输入自己学校所在地和赛场地点后,该地图应该推荐两条路线:一条是最快到达路线:一条是最短距离的路线.题目保证对任意的查询请求,地图上都至 ...
- PAT天梯赛练习题——L3-007. 天梯地图(多边权SPFA)
L3-007. 天梯地图 时间限制 300 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 本题要求你实现一个天梯赛专属在线地图,队员输入自己学校 ...
- PTA 天梯赛 L1
L1-002 打印沙漏 细节:就是在 (i>j&&i+j<r+1) 这个区间里才有空格,然后就是 for 循环 for(r=1; ;r+=2) 条件不满足之后还会再 ...
随机推荐
- [Idea Fragments]2013.08.08
# 1 今晚看到好几篇文章把golang,Node.js还有Nginx-lua拿来说事,Node.js现在自然比较熟悉,golang则有过一些了解,而Nginx-lua则少有听到. 有好事者对Node ...
- python 学习笔记 if语句
一.if语句的格式 语句块必须有相同的缩进. 语句块必须比if,elif,else多一层缩进 # 如果条件成立则执行语句块1, # 否则 如果条件2成立则执行语句块2 # 其他情况执行语句块3 # e ...
- C++ STL标准模板库(queue)
//queue的使用 #define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<queue> using name ...
- linux程序设计——主机字节序和网络字节序(第十五章)
15.2.10 主机字节序和网络字节序 当在基于intel处理器的linux机器上执行新版本号的server和客户程序时,能够用netstat命令查看网络连接状况.它显示了客户/server连接 ...
- 你不知道的C#ToString方法
我们都知道,String类型的ToString方法在我们平时的编程中应用非常的广泛,那么,对于那些很有用但又很少用的方法,你又熟悉几个呢?下面直接上代码: .ToString("C" ...
- combox使用要点
<select id="node_type" name="node_type" class="easyui-combobox" req ...
- abp项目如何按业务功能模块横向分割?
1.为什么要做分层? 请先看项目分层的最后结构: 2.设计的初衷 项目较大,且主题鲜明,分为:BI模块.DM-用户洞察模块.Manage-应用管理模块.Report应用分析报表模块,大模块之间并无依赖 ...
- js 代码风格(2)
Properties • 当访问属性的时候,我们使用点(.)操作符. var luke = { jedi: true, age: 28 }; // bad var isJedi = luke[' ...
- 蓝桥杯 第三届C/C++预赛真题(2) 古堡算式(数学题)
福尔摩斯到某古堡探险,看到门上写着一个奇怪的算式: ABCDE * ? = EDCBA 他对华生说:“ABCDE应该代表不同的数字,问号也代表某个数字!” 华生:“我猜也是!” 于是,两人沉默了好久, ...
- 【转】防止CListCtrl闪烁的几种方法
转载出处:http://blog.sina.com.cn/s/blog_5ee42ba30100g50j.html 1.使用SetRedraw禁止窗口重绘,操作完成后,再恢复窗口重绘 m_ctlLis ...