POJ 1547:Clay Bully
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 8349 | Accepted: 4711 |
Description
taking some clay from some other child. Since Ms. Terry always gives every child in a class the same amount of clay to begin with, you can write a program that helps Ms. Terry find the bully and victim after she measures each child's finished block.
Input
student information consists of three positive integers, representing the dimensions of the clay block, followed by the student's first name. There can never be more than 9 students nor less than 2 students in any class. Each student's name is at most 8 characters.
Ms. Terry always gives each student at most 250 cubic units of clay. There is exactly one bully and one victim in each class.
Output
Sample Input
3
10 10 2 Jill
5 3 10 Will
5 5 10 Bill
4
2 4 10 Cam
4 3 7 Sam
8 11 1 Graham
6 2 7 Pam
-1
Sample Output
Bill took clay from Will.
Graham took clay from Cam.
题意是老师本来给每个人的泥土是一样多的,但是有人从其他一个人那里多拿了泥土,给了每一个人泥土的体积,问谁多拿了谁的。
洪水滔天。求最大与最小。
代码:
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#pragma warning(disable:4996)
using namespace std; int stu[15];
string name[15]; int main()
{
int num,i;
while(cin>>num)
{
if(num==-1)
break;
int temp1,temp2,temp3;
for(i=1;i<=num;i++)
{
cin>>temp1>>temp2>>temp3>>name[i];
stu[i]=temp1*temp2*temp3;
}
int min_n=700,min_x;
int max_n=-1,max_x; for(i=1;i<=num;i++)
{
if(stu[i]>max_n)
{
max_x=i;
max_n=stu[i];
}
if(stu[i]<min_n)
{
min_x=i;
min_n=stu[i];
}
}
cout<<name[max_x]<<" took clay from "<<name[min_x]<<"."<<endl;
}
return 0;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
POJ 1547:Clay Bully的更多相关文章
- POJ 3321:Apple Tree + HDU 3887:Counting Offspring(DFS序+树状数组)
http://poj.org/problem?id=3321 http://acm.hdu.edu.cn/showproblem.php?pid=3887 POJ 3321: 题意:给出一棵根节点为1 ...
- POJ 3252:Round Numbers
POJ 3252:Round Numbers Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 10099 Accepted: 36 ...
- POJ 1459:Power Network(最大流)
http://poj.org/problem?id=1459 题意:有np个发电站,nc个消费者,m条边,边有容量限制,发电站有产能上限,消费者有需求上限问最大流量. 思路:S和发电站相连,边权是产能 ...
- POJ 3436:ACM Computer Factory(最大流记录路径)
http://poj.org/problem?id=3436 题意:题意很难懂.给出P N.接下来N行代表N个机器,每一行有2*P+1个数字 第一个数代表容量,第2~P+1个数代表输入,第P+2到2* ...
- POJ 2195:Going Home(最小费用最大流)
http://poj.org/problem?id=2195 题意:有一个地图里面有N个人和N个家,每走一格的花费是1,问让这N个人分别到这N个家的最小花费是多少. 思路:通过这个题目学了最小费用最大 ...
- POJ 3281:Dining(最大流)
http://poj.org/problem?id=3281 题意:有n头牛,f种食物,d种饮料,每头牛有fnum种喜欢的食物,dnum种喜欢的饮料,每种食物如果给一头牛吃了,那么另一个牛就不能吃这种 ...
- POJ 3580:SuperMemo(Splay)
http://poj.org/problem?id=3580 题意:有6种操作,其中有两种之前没做过,就是Revolve操作和Min操作.Revolve一开始想着一个一个删一个一个插,觉得太暴力了,后 ...
- POJ 3237:Tree(树链剖分)
http://poj.org/problem?id=3237 题意:树链剖分.操作有三种:改变一条边的边权,将 a 到 b 的每条边的边权都翻转(即 w[i] = -w[i]),询问 a 到 b 的最 ...
- POJ 2763:Housewife Wind(树链剖分)
http://poj.org/problem?id=2763 题意:给出 n 个点, n-1 条带权边, 询问是询问 s 到 v 的权值, 修改是修改存储时候的第 i 条边的权值. 思路:树链剖分之修 ...
随机推荐
- 在html中创建自定义标签
创建并使用自定义标签 Web Components 标准非常重要的一个特性是,它使开发者能够将HTML页面的功能封装为 custom elements(自定义标签),本篇介绍使用 CustomElem ...
- 解题报告:luogu P2299
题目链接:P2299 Mzc和体委的争夺战 单源最短路板子题吗,体面晦涩难懂(语文不好),以为是有向图,只有\(30pts\),其实是无向的,我使用了刚学来的\(SPFA\),通过了此题: \(Cod ...
- php中常用的加密函数
1.MD5加密: string md5 ( string $str [, bool $raw_output = false ] ) (1)md5()默认情况下以 32 字符十六进制数字形式返回散列值, ...
- maven集成SSM项目,Tomcat部署运行——SSM整合框架搭建(二)之问题
问题一.当放开controller中的方法,出现如下问题 ### Error querying database. Cause: org.springframework.jdbc.CannotGetJ ...
- NRF52840与NRF52832的性能区别
蓝牙版本的不断更新,大部分客户慢慢都向往着蓝牙5.0.当然对于前不久NORDIC刚出的蓝牙5.0 NRF52840,很多人都还不是很了解.NRF52840可以说是NRF52832的超强升级版,虽然同样 ...
- CentOS7 静默安装Oracle XE 11g
Oracle XE简介 Oracle Database 11g 快捷版 (Oracle Database XE) 是一款基于 Oracle Database 11g 第 2 版代码库的小型入门级数据库 ...
- 19 03 13 关于 scrapy 框架的 对环球网的整体爬取(存储于 mongodb 数据库里)
关于 spinder 在这个框架里面 和不用数据库 相同 # -*- coding: utf-8 -*- import scrapy from yang_guan.items import ...
- PATH环境 变量
PATH环境 变量 $HOME/.bash_profile和/etc/profile 两个文件在登陆用户的时候会执行, /etc/profile 所有用户都执行,$HOME/.bash_profile ...
- 八十二、SAP中的ALV创建之一,新建一个程序
一.创建一个ALV的程序 二.填写程序属性 三.保存到本地对象 四.来到代码区,这样一个新工程就创建好了,我们后续来写相关的创建代码
- 好记性不如烂笔头--shell参数及shell判断if系列
$0 当前脚本的文件名$n 传递给脚本或函数的参数.n 是一个数字,表示第几个参数.例如,第一个参数是$1,第二个参数是$2$# 传递给脚本或函数的参数个数$* 传递给脚本或函数的所有参数$@ 传递给 ...