zoukankan      html  css  js  c++  java
  • 小I的小姐姐

    小 I 的小姐姐

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

    小 I 去天津玩啦,一路上,他跟他的同学发生了许多有趣的事。

    当他们路过天津外国语学院时,他发现了许多小姐姐,他眼花缭乱,甚至不知道该去找哪个小姐姐聊天。

    怎么办怎么办!

    于是他想到了你,他拍了一张照片给你,你发现照片里一共有 n 个小姐姐(序号从 0 到 n - 1),每个小姐姐都有自己的风格,可以按特征划分出 3 个特征值  w1 , w2 , w3 ,你知道小 I 特别喜欢 w1 特征值高的小姐姐,不太看重 w3 ,于是你对于每个特征都赋予一个权重,分别对应为0.7 0.2 0.1,你能帮小 I 找出来他发来的这张照片里他最喜欢的小姐姐吗?

    Input

    多组输入,对于每组输入:

    • 第一行给出 n (n <= 5000) ,之后有 n 行数。
    • 每行数有三个数 w1, w2, w3,表示三个特征值。

    所有整数及结果都在整型范围内,不存在权值和相等的情况。

    Output

    n 个小姐姐中权值和最高的序号。

    Sample Input

    3
    1  5 10
    5 1 10
    10 5 1

    Sample Output

    2

    Hint

     

    Source

    【2017级《程序设计基础(B)II》期末上机考试】IceCapriccio
     
     1 #include <stdio.h>
     2 #include <stdlib.h>
     3 struct score{
     4     int w1;
     5     int w2;
     6     int w3;
     7 
     8 };
     9 int main()
    10 {
    11     int b[100];
    12     struct score a[5001];
    13     int t,i,max,num;
    14     while(~scanf("%d",&t))
    15     {
    16         for (i=0;i<t;i++)
    17         {
    18             scanf("%d %d %d",&a[i].w1,&a[i].w2,&a[i].w3);
    19         }
    20         for (i=0;i<t;i++)
    21         {
    22             b[i]=0.7*a[i].w1+0.2*a[i].w2+0.1*a[i].w3;
    23         }
    24         max=-1;num=0;
    25         for (i=0;i<t;i++)
    26         {
    27             if (b[i]>max) {max=b[i];num=i;}
    28         }
    29         printf("%d
    ",num);
    30     }
    31     return 0;
    32 }
  • 相关阅读:
    虚拟机网络配置常见问题总结
    Python
    Python
    Python
    Python
    Python
    Python
    MySQL
    MySQL
    MySQL
  • 原文地址:https://www.cnblogs.com/xiaolitongxueyaoshangjin/p/12031192.html
Copyright © 2011-2022 走看看