Little sister's little I

Little sister's little I

Time Limit: 1000 ms Memory Limit: 65536 KiB
Problem Description

I go to Tianjin Wanla small, along the way, he happened with his classmates many interesting things.

When they pass by Tianjin Foreign Studies University, he found a lot of little sister, he dazzled, I do not even know what the little sister went to chat.

How to do how to do!

So he thought of you, he took a picture for you, you find photos in a total of n small sister (numbers from 0 to n - 1), every little sister has its own style, can be divided according to characteristics 3 characteristic values ​​w1, w2, w3, particularly small I know you like high little sister feature values ​​w1, less value W3, so you for each feature is assigned a weight, corresponding to 0.2 to 0.7 0.1, help you small I find out he sent this picture of his favorite little sister do?

Input

Multiple sets of inputs, each input for:

  • The first line gives n (n <= 5000), then there are n number of rows.
  • There are three numbers per line w1, w2, w3, represents three characteristic values.

And the results are all integers in the range of integers, equal weights and the absence of.

Output

n sister and small weights in the highest sequence number.

Sample Input

3
1  5 10
5 1 10
10 5 1

Sample Output

2

Hint

 

Source

[2017 'program design (B) II "the end-on exam] IceCapriccio
 

#include <stdio.h>
#include <stdlib.h>
struct xiaojiejie
{
int w1,w2,w3;
double sum;
}st[5001],t;
int main()
{
int n,i;
while(scanf("%d",&n)!=EOF)
{
for(i=0;i<=n-1;i++)
{
scanf("%d %d %d",&st[i].w1,&st[i].w2,&st[i].w3);
st[i].sum=st[i].w1*0.7+st[i].w2*0.2+st[i].w3*0.1;
}
double max=st[0].sum;
int p=0;
for(i=1;i<=n-1;i++)
{
if(st[i].sum>max)
{
max=st[i].sum;
p=i;
}
}
printf("%d\n",p);
}

return 0;
}

Guess you like

Origin www.cnblogs.com/xiaolitongxueyaoshangjin/p/12031192.html