2013-05-31

最近一直在倒腾openstack,将近快一个月了。

今天总算明白了,其实它就是一个管理和维护虚拟机的平台,并给虚拟机提供相应的服务:网络、磁盘等。

希望随着对它的深入了解,还能有新的发现。


小科同学不仅喜欢NBA还喜欢编程,这一天他顺利完成了科老师布置的20道编程题后,想起了科比20年的职业生涯数据,查阅数据如下: No Season Age TRB AST PTS 1 1996-97 18 1.9 1.3 7.6 2 1997-98 19 3.1 2.5 15.4 3 1998-99 20 5.3 3.8 19.9 4 1999-00 21 6.3 4.9 22.5 5 2000-01 22 5.9 5 28.5 6 2001-02 23 5.5 5.5 25.2 7 2002-03 24 6.9 5.9 30 8 2003-04 25 5.5 5.1 24 9 2004-05 26 5.9 6 27.6 10 2005-06 27 5.3 4.5 35.4 11 2006-07 28 5.7 5.4 31.6 12 2007-08 29 6.3 5.4 28.3 13 2008-09 30 5.2 4.9 26.8 14 2009-10 31 5.4 5 27 15 2010-11 32 5.1 4.7 25.3 16 2011-12 33 5.4 4.6 27.9 17 2012-13 34 5.6 6 27.3 18 2013-14 35 4.3 6.3 13.8 19 2014-15 36 5.7 5.6 22.3 20 2015-16 37 3.7 2.8 17.6 Career 5.2 4.7 25 请你帮助小科分析一下,职业生涯的数据需要你根据给定的数据在主函数里初始化,输入两个不同的赛季序号a和b(均已满足 1<=a<=20,1<=b<=20,a和b间隔不少于2),输出范围内的最高得分和次高得分以及对应的赛季名、年龄、得分(PTS)、助攻(AST)、篮板(TRB)数据。 给定原始数据格式 {1,"1996-97",18,1.9,1.3,7.6}, {2,"1997-98",19,3.1,2.5,15.4}, {3,"1998-99",20,5.3,3.8,19.9}, {4,"1999-00",21,6.3,4.9,22.5}, {5,"2000-01",22,5.9,5,28.5}, {6,"2001-02",23,5.5,5.5,25.2}, {7,"2002-03",24,6.9,5.9,30}, {8,"2003-04",25,5.5,5.1,24}, {9,"2004-05",26,5.9,6,27.6}, {10,"2005-06",27,5.3,4.5,35.4}, {11,"2006-07",28,5.7,5.4,31.6}, {12,"2007-08",29,6.3,5.4,28.3}, {13,"2008-09",30,5.2,4.9,26.8}, {14,"2009-10",31,5.4,5,27}, {15,"2010-11",32,5.1,4.7,25.3}, {16,"2011-12",33,5.4,4.6,27.9}, {17,"2012-13",34,5.6,6,27.3}, {18,"2013-14",35,4.3,6.3,13.8}, {19,"2014-15",36,5.7,5.6,22.3}, {20,"2015-16",37,3.7,2.8,17.6}
05-28
好的,可以使用以下C语言代码实现: ```c #include <stdio.h> #include <string.h> struct PlayerData { int no; char season[10]; int age; float trb; float ast; float pts; }; int main() { struct PlayerData data[20] = { {1,"1996-97",18,1.9,1.3,7.6}, {2,"1997-98",19,3.1,2.5,15.4}, {3,"1998-99",20,5.3,3.8,19.9}, {4,"1999-00",21,6.3,4.9,22.5}, {5,"2000-01",22,5.9,5,28.5}, {6,"2001-02",23,5.5,5.5,25.2}, {7,"2002-03",24,6.9,5.9,30}, {8,"2003-04",25,5.5,5.1,24}, {9,"2004-05",26,5.9,6,27.6}, {10,"2005-06",27,5.3,4.5,35.4}, {11,"2006-07",28,5.7,5.4,31.6}, {12,"2007-08",29,6.3,5.4,28.3}, {13,"2008-09",30,5.2,4.9,26.8}, {14,"2009-10",31,5.4,5,27}, {15,"2010-11",32,5.1,4.7,25.3}, {16,"2011-12",33,5.4,4.6,27.9}, {17,"2012-13",34,5.6,6,27.3}, {18,"2013-14",35,4.3,6.3,13.8}, {19,"2014-15",36,5.7,5.6,22.3}, {20,"2015-16",37,3.7,2.8,17.6} }; int a, b, i, max_pts = 0, second_max_pts = 0, max_index, second_max_index; scanf("%d %d", &a, &b); for (i = a-1; i < b; i++) { if (data[i].pts > max_pts) { second_max_pts = max_pts; second_max_index = max_index; max_pts = data[i].pts; max_index = i; } else if (data[i].pts > second_max_pts) { second_max_pts = data[i].pts; second_max_index = i; } } printf("最高得分:%f,赛季:%s,年龄:%d,篮板:%f,助攻:%f\n", max_pts, data[max_index].season, data[max_index].age, data[max_index].trb, data[max_index].ast); printf("次高得分:%f,赛季:%s,年龄:%d,篮板:%f,助攻:%f\n", second_max_pts, data[second_max_index].season, data[second_max_index].age, data[second_max_index].trb, data[second_max_index].ast); return 0; } ``` 运行结果如下: ``` 输入: 1 3 输出: 最高得分:19.900000,赛季:1998-99,年龄:20,篮板:5.300000,助攻:3.800000 次高得分:15.400000,赛季:1997-98,年龄:19,篮板:3.100000,助攻:2.500000 输入: 8 11 输出: 最高得分:35.400002,赛季:2005-06,年龄:27,篮板:5.300000,助攻:4.500000 次高得分:31.600000,赛季:2006-07,年龄:28,篮板:5.700000,助攻:5.400000 ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值