Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdio.h"
- int main() {
- int count, rate, school;
- char *last, *first;
- int max = -1;
- int max_count = 0;
- char* max_last;
- char* max_first;
- char* max_last_second;
- char* max_first_second;
- int max2 = -1;
- int max2_count = 0;
- char* max2_last;
- char* max2_first;
- scanf("%d",&count);
- for(int i=0;i < count;i++){
- scanf("%s", last);
- scanf("%s", first);
- scanf("%d", &school);
- scanf("%d", &rate);
- if (school == 50) {
- if(rate > max){
- max2 = max;
- max2_count = 1;
- max = rate;
- max_count = 0;
- max_last = last;
- max_first = first;
- }
- if(rate == max) {
- max_count++;
- max_last_second = last;
- max_first_second = first;
- }
- if(max2 < rate && rate < max){
- max2 = rate;
- max2_count = 0;
- max2_last = last;
- max2_first = first;
- }
- if(rate == max2) {
- max2_count++;
- }
- }
- }
- if(max_count == 2){
- printf("%s", max_last);
- printf("%s", max_last_second);
- }
- if(max_count > 2){
- printf("%d", max_count);
- }
- if(max_count == 1 && max2_count > 1){
- printf("%s", max2_last);
- }
- printf("max: %d\n", max );
- printf("max_count: %d\n", max_count );
- printf("max2: %d\n", max2 );
- printf("max2_count: %d\n", max2_count );
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement