| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 392 人关注过本帖
标题:一道水题,测试数据都对,不知道错哪里
只看楼主 加入收藏
傻瓜菜
Rank: 2
来 自:earth
等 级:论坛游民
帖 子:73
专家分:66
注 册:2011-10-4
结帖率:94.44%
收藏
已结贴  问题点数:20 回复次数:3 
一道水题,测试数据都对,不知道错哪里
程序代码:
#include<stdio.h>
int main()
{
    int t,n,h,m,s,a[100][3],same[100][2],i,temp;
    while(scanf("%d",&n)&&(n>0))
    {
        for(i=0;i<n;i++)
            a[i][2]=0;
        for(i=0;i<n;i++)
        {
            scanf("%d %d:%d:%d",&t,&h,&m,&s);
            a[i][0]=t;a[i][1]=h*3600+m*60+s;
            if(a[i][0]==5) a[i][2]=100;
            if(a[i][0]==0) a[i][2]=50;
        }
        m=0;
        for(i=0;i<n;i++)
        {
            if(a[i][0]>0&&a[i][0]<5&&a[i][2]==0)
            {
                for(h=i;h<n;h++)
                    if(a[i][0]==a[h][0])
                    {same[m][0]=h;same[m][1]=a[h][1];m++;}
                for(h=0;h<m;h++)
                    for(s=h+1;s<m;s++)
                        if(same[h][1]>same[s][1])
                        {
                            temp=same[h][1];same[h][1]=same[s][1];same[s][1]=temp;
                            temp=same[h][0];same[h][0]=same[s][0];same[s][0]=temp;
                        }
                for(h=0;h<m;h++)
                    if(m%2==1)
                        if(a[same[h][0]][1]<same[(m-1)/2][1])
                            a[same[h][0]][2]=55+a[same[h][0]][0]*10;
                        else
                            a[same[h][0]][2]=50+a[same[h][0]][0]*10;
                    else
                        if(a[same[h][0]][1]<=same[(m-1)/2][1])
                            a[same[h][0]][2]=55+a[same[h][0]][0]*10;
                        else
                            a[same[h][0]][2]=50+a[same[h][0]][0]*10;
            }
        }
        for(i=0;i<n;i++)
            printf("%d\n",a[i][2]);
        printf("\n");
    }
    return 0;
}

题目来啦:http://acm.hdu.
搜索更多相关主题的帖子: 测试 数据 
2012-02-25 00:13
reab
Rank: 2
等 级:论坛游民
帖 子:1
专家分:10
注 册:2012-2-25
收藏
得分:10 
新手前来观摩~
2012-02-25 00:51
laoyang103
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:内蒙古包头
等 级:贵宾
威 望:19
帖 子:3082
专家分:11056
注 册:2010-5-22
收藏
得分:10 
不知道为什么我进不去   是不是内部比赛   你把题目沾过来  或者把题号说下

                                         
===========深入<----------------->浅出============
2012-02-25 11:34
傻瓜菜
Rank: 2
来 自:earth
等 级:论坛游民
帖 子:73
专家分:66
注 册:2011-10-4
收藏
得分:0 
回复 3楼 laoyang103
Problem Description
“Point, point, life of student!”
This is a ballad(歌谣)well known in colleges, and you must care about your score in this exam too. How many points can you get? Now, I told you the rules which are used in this course.
There are 5 problems in this final exam. And I will give you 100 points if you can solve all 5 problems; of course, it is fairly difficulty for many of you. If you can solve 4 problems, you can also get a high score 95 or 90 (you can get the former(前者) only when your rank is in the first half of all students who solve 4 problems). Analogically(以此类推), you can get 85、80、75、70、65、60. But you will not pass this exam if you solve nothing problem, and I will mark your score with 50.
Note, only 1 student will get the score 95 when 3 students have solved 4 problems.
I wish you all can pass the exam!
Come on!
 

Input
Input contains multiple test cases. Each test case contains an integer N (1<=N<=100, the number of students) in a line first, and then N lines follow. Each line contains P (0<=P<=5 number of problems that have been solved) and T(consumed time). You can assume that all data are different when 0<p.
A test case starting with a negative integer terminates the input and this test case should not to be processed.
 

Output
Output the scores of N students in N lines for each case, and there is a blank line after each case.
 

Sample Input
4
5 06:30:17
4 07:31:27
4 08:12:12
4 05:23:13
1
5 06:30:17
-1
 

Sample Output
100
90
90
95

100
2012-02-25 20:32
快速回复:一道水题,测试数据都对,不知道错哪里
数据加载中...
 
   



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

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