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 ...
随机推荐
- mysql copy复制拷贝表数据及结构的几种方式(转)
mysql拷贝表操作我们会常常用到,下面就为您详细介绍几种mysql拷贝表的方式,希望对您学习mysql拷贝表方面能够有所帮助.假如我们有以下这样一个表:id username password--- ...
- Swift正在使用NSURLConnection异步下载同步(实例解析)
原版的blog.转载请注明出处 http://blog.csdn.net/hello_hwc 一.同步异步两个概念 简单来讲.同步就是函数或者闭包(objective c中的block)运行完成才干返 ...
- cocos2d-x V3.0 呼叫加速度计 Acceleration
今天克服了一个问题,我觉得非常酷 哈哈. 今天得到解决cocos2d-x 3.0 呼叫重力加速器问题,上网查了很多资料 发现是不够,不解决这个问题,我不知道如果我使用3.0 这一问题的版本号,但是,这 ...
- ueditor问题解决
ueditor图片无法上传? 解决: imageUp.ashx 去掉这一行 <%@ Assembly Src="Uploader.cs" %> 参考: http://w ...
- 使用clojure訪问SQL Server数据库
(require '[korma.core :as kc]) (require '[korma.db :as kd]) (Class/forName "com.microsoft.jdbc. ...
- MongoDB学习笔记-基础概念
mongodb中基本的概念 文档.集合.数据库 与关系数据库的概念对比更容易理解
- SICP-2锻炼.34
[锻炼2.34] 为x给定值,找到一个多项式x的值,它也可以被形式化为累积. 下多项式的值: an*x^n + an-1*x^n-1 + .... + a1*x + a0 採用著名的Horner规则, ...
- 联想昭阳e43l笔记本配置
驱动精灵硬件检测报告 版本:2015.3.26.1363(8.1.326.1363)========================================================== ...
- 开源Math.NET基础数学类库使用(08)C#进行数值积分
原文:[原创]开源Math.NET基础数学类库使用(08)C#进行数值积分 本博客所有文章分类的总目录:http://www.cnblogs.com/asxinyu/p/4 ...
- JAVA设计模式(08):结构化-飞锤(Flyweight)
当前咱们国家正在大力倡导构建和谐社会,当中一个非常重要的组成部分就是建设资源节约型社会,"浪费可耻,节俭光荣". 在软件系统中,有时候也会存在资源浪费的情况,比如在计算机内存中存储 ...