joj2090
2011-08-29 09:24
232 查看
2090: Clay Bully
Result | TIME Limit | MEMORY Limit | Run Times | AC Times | JUDGE |
---|---|---|---|---|---|
3s | 8192K | 414 | 260 | Standard |
on 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
There are one or more classes of students, followed by a final line containing only the value -1. Each class starts with a line containing an integer,n, which is the number of students in the class, followed by n lines of student information. Each line of 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
For each class print a single line exactly as shown in the sample 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.
This problem is used for contest:
15
Submit /
Problem List / Status /
Discuss
Problem Set with Online Judge System Version 3.12
Jilin University
Developed by skywind,
SIYEE
#include<cstdio>
class student
{
public:
char name[10];
int volume;
};
int main()
{
student stu[10];
int n;
while(scanf("%d",&n)==1)
{
if(n==-1)break;
for(int i=0;i<n;i++)
{
int u,v,t;
scanf("%d%d%d",&u,&v,&t);
stu[i].volume=u*v*t;
getchar();
gets(stu[i].name);
}
int max=0,min=0;
for(int i=1;i<n;i++)
{
if(stu[i].volume>stu[max].volume)
{
max=i;
}
if(stu[i].volume<stu[min].volume)
{
min=i;
}
}
printf("%s took clay from %s.\n",stu[max].name,stu[min].name);
}
return 0;
}
相关文章推荐
- JOJ 2391 words
- JOJ 1106 Complicated Expressions
- JOJ 1064: Caeser Comes Back 解题报告
- joj 1107: Factorial
- 忘了是joj第几题了 剩余定理
- joj 2319
- joj 1595 Combinations
- joj 2443
- joj 2223: A Bug's Life (ws版的并查集)
- JOJ 1089 & ZOJ 1060 & poj 1094 Sorting It All Out (邻接表的栈拓扑排序模板)
- joj 1509
- joj1175
- joj 2724: Hua Rong Dao 最小割
- joj1006
- joj 1317
- joj2699
- JOJ1728:Power of Cryptography
- joj1277
- FZU 2090 无向图最小环 floyd
- 杭电2090