hdu acm steps 1.3.7

题目:http://acm.hdu.edu.cn/showproblem.php?pid=1718

就是找比他大的分数的个数

下面是AC代码:

#include <iostream>
using namespace std;

int main()
{
    int x, y, z;
    int p[1001];
    while ( cin >> x ) {
        int i = 0;
        int j;
        while ( cin >> y >> z && ( y || z ) ) {
            p[i++] = z;
            if ( x == y ) x = z;
        }

        int num = 1;
        for ( j = 0; j < i; ++j ) {
            if ( p[j] > x ) ++num;          /////计算几个数比该生大;
        }
        cout << num << endl;
    }
    return 0;
}


 

你可能感兴趣的:(hdu acm steps 1.3.7)