标题:请教一道题
只看楼主
zhanghuan_10
Rank: 1
等 级:新手上路
威 望:2
帖 子:751
专家分:0
注 册:2006-10-25
 问题点数:0 回复次数:0 
请教一道题

Choices

--------------------------------------------------------------------------------

Time limit: 1sec. Submitted: 127
Memory limit: 32M Accepted: 63

Source : 计算机学院第二届“光熙杯”程序设计大赛

--------------------------------------------------------------------------------

mostleg is going to attend an exam. All the problems are of the kind "Multiple choices". They all have 4 options and only one of them is right.

In order to get a good mark, he has trained himself for a long time. But he find that he made quite little progress! After the hard work, he only got such an ability that when he saw a problem, he would know the probablity that he could give a right choice. The exam is coming, how to use this ability?

Input

The first line of the input file contains a single integer n (1 <= n <= 300), the number of problems, followed by n lines each containing one real number xi,denoting the probability that he can choose a right choice for this problem.

Output

n lines at all, each display "H%" where H is the percentage chance that he get mark from this problem. Please round H down to the nearest integer before display.

Sample Input

3
1.00
0.65
0.16

Sample Output

100%
65%
28%


#include <stdio.h>
#include <string.h>
int main(void)
{
int a;

scanf("%d", &a);

getchar();
int i = 0, j = 0;

for (i = 0;i < a;i ++)
{
char str[4];

gets(str);

if (str[j] - '0' == 1)
{
printf("100%%\n");
}

else
{
int b = (str[2] - '0') * 10 + (str[3] - '0');

if (b >= 25)
{
printf("%d%%\n", b);
}
else
{
printf("%d%%\n", (100 - b) / 3);
}
}
}

return 0;
}
程序有些乱 程序本身没错 测试结果也对 找了半天找不到那里错了 感觉理解的也不错 大家帮看看

搜索更多相关主题的帖子: 计算机 limit get 大赛 
2007-09-13 15:34



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




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

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