Codeforces 437A The Child and Homework
题目链接:Codeforces 437A The Child and Homework
少看了一个条件,最后被HACK掉到203名,要不然就冲到100多一点了==。。
做这个题收获最大的是英语,A twice longer than B 表示 A >= 2 * B,A twice shorter than B表示 A * 2 <= B。
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm> using namespace std; struct AA
{
int a, i;
}; int cmp(AA b, AA c)
{
return b.a < c.a;
} int main()
{
char a[120], b[120], c[120], d[120];
scanf("%s%s%s%s", a, b, c, d);
AA aa[4];
aa[0].a = strlen(a) - 2;
aa[0].i = 0;
aa[1].a = strlen(b) - 2;
aa[1].i = 1;
aa[2].a = strlen(c) - 2;
aa[2].i = 2;
aa[3].a = strlen(d) - 2;
aa[3].i = 3;
sort(aa, aa + 4, cmp);
int vis = 0;
int k;
if(aa[0].a * 2 <= aa[3].a && aa[0].a * 2 <= aa[2].a && aa[0].a * 2 <= aa[1].a)
{
vis++;
k = aa[0].i;
}
if(aa[3].a >= aa[0].a * 2 && aa[3].a >= aa[1].a * 2 && aa[3].a >= aa[2].a * 2)
{
vis++;
k = aa[3].i;
}
if(vis == 1)
cout << (char)(k + 'A') << endl;
else
cout << "C" << endl;
return 0;
}
Codeforces 437A The Child and Homework的更多相关文章
- codeforces 437A. The Child and Homework 解题报告
题目链接:http://codeforces.com/problemset/problem/437/A 题目意思:给出四个选项A.B.C.D选项的内容描述,要求选出符合以下条件的一项. (1)如果某个 ...
- Codeforces Round #250 (Div. 2)—A. The Child and Homework
好题啊,被HACK了.曾经做题都是人数越来越多.这次比赛 PASS人数 从2000直掉 1000人 被HACK 1000多人! ! ! ! 没见过的科技啊 1 2 4 8 这组数 被黑的 ...
- xtu read problem training 3 A - The Child and Homework
The Child and Homework Time Limit: 1000ms Memory Limit: 262144KB This problem will be judged on Code ...
- Codeforces 437B The Child and Set
题目链接:Codeforces 437B The Child and Set 開始是想到了这样的情况,比方lowbit之后从大到小排序后有这么几个数,200.100,60.50.S = 210.那先选 ...
- cf437A The Child and Homework
A. The Child and Homework time limit per test 1 second memory limit per test 256 megabytes input sta ...
- Codeforces 437C The Child and Toy(贪心)
题目连接:Codeforces 437C The Child and Toy 贪心,每条绳子都是须要割断的,那就先割断最大值相应的那部分周围的绳子. #include <iostream> ...
- Codeforces 437E The Child and Polygon(间隔DP)
题目链接:Codeforces 437E The Child and Polygon 题目大意:给出一个多边形,问说有多少种切割方法.将多边形切割为多个三角形. 解题思路:首先要理解向量叉积的性质,一 ...
- Codeforces 437D The Child and Zoo(贪心+并查集)
题目链接:Codeforces 437D The Child and Zoo 题目大意:小孩子去參观动物园,动物园分非常多个区,每一个区有若干种动物,拥有的动物种数作为该区的权值.然后有m条路,每条路 ...
- Codeforces 437D The Child and Zoo(并查集)
Codeforces 437D The Child and Zoo 题目大意: 有一张连通图,每个点有对应的值.定义从p点走向q点的其中一条路径的花费为途径点的最小值.定义f(p,q)为从点p走向点q ...
随机推荐
- Linux命令对应的全称解释(转)
Filesystem Hierarchy Standard(FHS) /:根目录,所有的目录.文件.设备都在/之下,/就是Linux文件系统的组织者,也是最上级的领导者. /bin:bin 就是二进 ...
- WCF配置文件
因为要上传较大的图片,WCF传递数组的默认的最大数组16KB就不够了.以下讲解配置内容. 服务端配置 这里一个WCF项目中有1个服务,配置文件如下(位于system.serviceModel标签中): ...
- 找出二叉树中和为n的路径
题目描述: 输入一个整数和一棵二元树.从树的根结点开始往下访问一直到叶结点所经过的所有结点形成一条路径.打印出和 与输入整数相等的所有路径. 二叉树中的路径 从二叉树的根节点出发,至二叉树的叶子节点的 ...
- python可变交换性能优化
离许多新的压力python性能优化见交换两个变量值可以使用 a,b = b,a 这样能够提高性能 >>> from timeit import Timer >>> ...
- BootStrap -- Grid System
<script src="jquery.1.9.js"></script> <script src="js/bootstrap.min.js ...
- C++ 习题 输出日期时间--友元类
Description 设计一个日期类和时间类,编写display函数用于显示日期和时间.要求:将Time类声明为Date类的友元类,通过Time类中的display函数引用Date类对象的私有数据, ...
- 微渠道发展 BAE交通运输平台和java呼声,微信mysql数据库开发实例 --图文开发教程
持续更新 BAE java开展mysql数据库 图文教程 BAE java语言发展mysql源码下载: 目前微信的发展.BAE开展.java开展.mysql教程开发非常,的介绍基于BAE平台.java ...
- HDU--3081--Marriage Match II--最大匹配,匈牙利算法
Marriage Match II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others ...
- 双链表---LinkedList的重写
重写Linkedlist类,改写为MyLinkedList,未继承Iterable类. public class MyLinkedList<AnyType> { private int t ...
- python获取的信息列表微信公共平台和用户头像
转载注明原文地址:http://blog.csdn.net/btyh17mxy/article/details/25207889 只写模拟登陆的方式获取微信从信息和头像库列表公共平台, - 相关后,功 ...