Thursday 14 January 2016

Solution of URI 1983 :: The Chosen


Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.

/**Bismillahir Rahmanir Rahim.**/

#include <stdio.h>
int main()
{
    int stdent;
    scanf("%d", &stdent);
    int code[stdent], i, final_code;
    double note[stdent], max=0.0;

    for(i=0; i<stdent; i++)
        scanf("%d  %lf", &code[i], &note[i]);
    for(i=0; i<stdent; i++)
    {
        if(note[i]>max)
        {
            max = note[i];
            final_code = i;
        }
    }

    if(max<8)
        printf("Minimum note not reached\n");
    else
        printf("%d\n", code[final_code]);
    return 0;
}

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.