标题:[求助]不知为什么错
只看楼主
梦幻人生
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2007-1-1
 问题点数:0 回复次数:3 
[求助]不知为什么错

RPG (Role Play Games) is Vivid's favorite computer game type, such as Final Fantasy and Xian Jian Qi Xia Zhuan are both of this type. You may be even more familiar with it than Vivid is.

In these games, characters may have many attributes, e.g. physical force, attack ability, defence ability and so on. A lot of equipment types (weapon, armor, costume and so on) are also available in these games, and the equipments can alter (promotion or reduction) those character-attributes. E.g. Equipment with the attributes 10, 0, -10 means it will promote the first attribute of the character by 10, reduce the third attribute of the character by 10, and keep the second attribute unchanged.


In this problem, characters only have 3 attributes -- physical force, attack ability and defence ability. Lots of equipment types are available. You can choose at most one equipment from each type. Your goal is to make the lowest attribute as high as possible. If more than one choice exist, choose the one with higher value of the second lowest attribute. If there is still a tie, choose the one with higher highest attribute, you will be guaranteed that there is no tie then. For example, if one choice is 10, 20, 30 and the other one is 11, 11, 11, then the second will be chosen, for the lowest attribute of later is 11 while the lowest attribute of the former is 10. Another example, if one choice is 10, 20, 30 and another choice is 20, 10, 29, then the first will be chosen, for the lowest and the second lowest attributes of them are equal, and the highest attribute of the first is higher than the second.

Input:

The first line of the input is the total number of the test cases. Each test case begins will an integer T (the number of the equipment types, 1 <= T <= 16). Each block of equipment types will begins with an integer E (0 <= E <= 16), indicating the number of equipments of this type. Then E lines follows, each of them contains three integers A, B, C (all of them are in the range of [-100, 100]) indicating the effect to the character attributes (physical force, attack ability and defence ability).

Output:

Three integers should be printed in a single line for each test case, which are the final attribute values of physical force, attack ability and defence ability after equipment.

Sample Input:
2
1
2
10 20 30
11 11 11
1
2
10 20 30
20 10 29

Sample Output:
11 11 11
10 20 30

这是我们学校的online judge,为什么我提交时,系统显示错误(它说解决方案对,输入与题目要求不符).
请你们帮忙看一下.我的程序是:
#include<stdio.h>
void sort(int a[])
{ int t;
if(a[0]>a[1])t=a[0],a[0]=a[1],a[1]=t;
if(a[0]>a[2])t=a[0],a[0]=a[2],a[2]=t;
if(a[1]>a[2])t=a[1],a[1]=a[2],a[2]=t;
}
void deal(int s[],int t[])
{ int a[3],b[3],i,j;
for(i=0;i<3;++i){
a[i]=s[i];
b[i]=t[i];}
sort(a);
sort(b);
for(i=0;i<3;++i){
if(a[i]>b[i])
for(j=0;j<3;++j)
t[j]=s[j];
if(a[i]-b[i])break;}
}
main()
{ int re,i,j,t,a,b,k,s[16][3];
scanf("%d",&re);
for(i=0;i<re;++i){
scanf("%d",&a);
for(j=0;j<a;++j){
scanf("%d",&b);
for(t=0;t<b;++t)
for(k=0;k<3;++k)
scanf("%d",&s[t][k]);
if(b){
for(k=0;k<b-1;++k)
deal(s[k],s[k+1]);
for(k=0;k<3;++k)
printf("%d ",s[b-1][k]);
printf("\n");}}
}
}

搜索更多相关主题的帖子: available equipment promotion computer familiar 
2007-01-05 15:43
senyee
Rank: 1
等 级:新手上路
帖 子:422
专家分:0
注 册:2006-11-28
得分:0 
能翻译下莫?

菜鸟~~请多指教~~
2007-01-05 16:01
梦幻人生
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2007-1-1
得分:0 
大家花点时间帮帮忙好吗?

You are larger than life!
2007-01-06 13:43
mn51pj
Rank: 1
等 级:新手上路
帖 子:47
专家分:0
注 册:2006-12-1
得分:0 

看前面英语 我居然看懂了大概意思
感觉自己还不是文盲

2007-01-06 14:04



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-114427-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.179395 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved