【PAT】1036. Boys vs Girls
2017-01-17 16:33
134 查看
#include <iostream> #include <cstdio> #include <cstring> using namespace std; struct person{ char id[15]; char name[15]; int grade; char sex; }high,low,temp; void init(){ high.grade=-1; low.grade=101; } int main() { int n; cin>>n; int flagM=0,flagF=0; init(); while(n--){ scanf("%s %c %s %d",temp.name,&temp.sex,temp.id,&temp.grade); if(temp.sex=='F' && temp.grade>high.grade){ high=temp;flagF=1;} if(temp.sex=='M' && temp.grade<low.grade){ low=temp;flagM=1;} } if(flagF) printf("%s %s\n",high.name,high.id); else cout<<"Absent"<<endl; if(flagM) printf("%s %s\n",low.name,low.id); else cout<<"Absent"<<endl; if(flagF && flagM) cout<<high.grade-low.grade<<endl; else cout<<"NA"<<endl; return 0; }
相关文章推荐
- PAT 甲级 1036. Boys vs Girls (25)
- 【C++】PAT(advanced level)1036. Boys vs Girls (25)
- PAT 1036. Boys vs Girls (25)
- PAT (Advanced) 1036. Boys vs Girls (25)
- PAT (Advanced Level) Practise 1036 Boys vs Girls (25)
- 【PAT (Advanced Level)】1036. Boys vs Girls (25)
- 浙江大学PAT_甲级_1036. Boys vs Girls (25)
- PAT 1036. Boys vs Girls (25)
- PAT甲级1036. Boys vs Girls (25)
- PAT(甲级)1036. Boys vs Girls (25)
- 【PAT】【Advanced Level】1036. Boys vs Girls (25)
- PAT (Advanced Level)1036. Boys vs Girls (25)
- 1036. Boys vs Girls (25)-PAT甲级真题
- pat 1036. Boys vs Girls (25)
- PAT (Advanced Level) 1036. Boys vs Girls (25) 解题报告
- 浙大PAT 1036题 1036. Boys vs Girls
- PAT程序设计考题——甲级1036( Boys vs Girls ) C++实现
- 1036. Boys vs Girls (25)【水题】——PAT (Advanced Level) Practise
- PAT (Advanced Level) 1036. Boys vs Girls (25) 结构体排序
- PAT-A-1036. Boys vs Girls (25)