1.求区间最高分
int getMax(int *pScore, int low, int high) { if(low > high) { high = low ^ high; low = low ^ high; high = low ^ high; } int maxScore = pScore[low]; for(int i = low + 1; i <= high; ++i) { if(maxScore < pScore[i]) { maxScore = pScore[i]; } } return maxScore; } int main() { int N = 0; int M = 0; while(cin >> N >> M) { int *pScore = new int[N + 1]; for(int i = 1; i <= N; ++i) { cin >> pScore[i]; } for(int i = 0; i < M; ++i) { char ch = '