博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
1011. World Cup Betting (20)
阅读量:4150 次
发布时间:2019-05-25

本文共 920 字,大约阅读时间需要 3 分钟。

考察查询表以及信息记录

#include 
char g_CharTable[3] = {'W', 'T', 'L'};void CheckCharTable(){ int cnt = 3; for(int i = 0; i < cnt; ++i) printf("%c\n", g_CharTable[i]);}int main(){ //CheckCharTable(); float a[3][3]; while(scanf("%f%f%f", &a[0][0], &a[0][1], &a[0][2]) != EOF) { for(int i = 1; i < 3; ++i) scanf("%f%f%f", &a[i][0], &a[i][1], &a[i][2]); int maxIndex[3]; float maxValue[3]; //get max index & value for(int i = 0; i < 3; ++i) { float tmpMaxValue = a[i][0]; int tmpMaxIndex = 0; for(int j = 0; j < 3; ++j) { if(a[i][j] > tmpMaxValue) { tmpMaxValue = a[i][j]; tmpMaxIndex = j; } } maxIndex[i] = tmpMaxIndex; maxValue[i] = tmpMaxValue; } //get resut float ans = (maxValue[0]*maxValue[1]*maxValue[2]*0.65-1.0)*2.0; //output for(int i = 0; i < 3; ++i) printf("%c ", g_CharTable[maxIndex[i]]); //ans += 0.005;//up to 2 decimal places printf("%.2f\n", ans); } return 0;}

 

转载地址:http://taxti.baihongyu.com/

你可能感兴趣的文章
数据库索引
查看>>
实现包含min,max,push,pop函数的栈
查看>>
实验2-6 字符型数据的输入输出
查看>>
实验3-5 编程初步
查看>>
实验4-1 逻辑量的编码和关系操作符
查看>>
实验5-2 for循环结构
查看>>
实验5-3 break语句和continue语句
查看>>
实验5-4 循环的嵌套
查看>>
实验5-5 循环的合并
查看>>
实验5-6 do-while循环结构
查看>>
实验5-7 程序调试入门
查看>>
实验5-8 综合练习
查看>>
第2章实验补充C语言中如何计算补码
查看>>
深入入门正则表达式(java) - 命名捕获
查看>>
使用bash解析xml
查看>>
android系统提供的常用命令行工具
查看>>
【Python基础1】变量和字符串定义
查看>>
【Python基础2】python字符串方法及格式设置
查看>>
【Python】random生成随机数
查看>>
【Python基础3】数字类型与常用运算
查看>>