1083. List Grades

来源:互联网 发布:java测试工程师笔试题 编辑:程序博客网 时间:2024/06/06 03:28
#include <cstdio>#include <cstring>#define MAX 105 typedef struct D{char name[15] ;char id[15] ;int grade ;}D ;D data[MAX];int main(void){//freopen("input.txt" , "r"  , stdin);int N ;int i ; int low , high ;bool isHas =  false ;scanf("%d" , &N);for( i = 0 ; i <MAX ; i ++){D d ;d.grade = -1 ;data[i] = d ;}while(N--){D d ;scanf("%s %s %d" , d.name , d.id ,  &d.grade);data[d.grade] = d ;}scanf("%d %d" , &low , &high);for( ; high >= low ; high-- ){if( data[high].grade != -1  ){isHas = true ;printf("%s %s\n" , data[high].name , data[high].id);}}if( !isHas ){printf("NONE\n");}return 0 ;}

0 0
原创粉丝点击