【ACM】杭电ACM题一直WA求高手看看代码

FireShot Pro Screen Capture #015 - 'HangZhouDianZiUniversity' - acm_hdu_edu_cn_game_entry_problem_show_php_chapterid=1&sectionid=3&problemid=18

数据测试了好几个都没问题,可以就是WA不让过,检测了2个小时还是没发现有什么问题T_T!!求高手看看代码,小弟在此谢谢各位哦!

#include <stdio.h>
#include <stdlib.h>
#define max 1000
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
    int  stu[max];   //学生的ID 
    int  stur[max];  //学生的成绩 
    int rank,jack_id; //查找的ID 
    int flag[101];        
    int i,jack,n;
    freopen("in.txt","r",stdin);
    while(scanf("%d",&jack)!=EOF){
        for( i=0 ; i<max ;i++) {
            stu[i]=0;
            stur[i]=0;
        }
        for( i=0 ; i<101 ;i++) {
            flag[i]=1;
        }
        for( i=0 ;  ;i++) {
            scanf("%d%d",&stu[i],&stur[i]);
            if(stu[i]==0&&stur[i]==0) break;
        }
        n=i;
        for( i=0 ; i<n ; i++) {
            if(jack==stu[i]) {
                jack_id=i;
            }
        }
        rank=1;
        for( i=0 ; i<n ; i++) {
            if((stur[i]>stur[jack_id])&&(flag[stur[i]]!=0)){    //找到比自己大的成绩rank++ 
                rank++;
                flag[stur[i]]=0;
            }
                
        }
        printf("%d
",rank);
    
    }
    
    
    return 0;
}
原文地址:https://www.cnblogs.com/hInstance/p/3462173.html