标签:style blog color io for ar 2014 div
/******************************************************************** @file Main_practise.cpp @date 2014-8-22 @author Tiger @brief Problem D: Above Average ********************************************************************/ #include <cstdio> //#define OJ int main(int argc, const char* argv[]) { #ifdef OJ freopen("input.txt", "r", stdin); #endif int nTestCases = 0; scanf("%d", &nTestCases); while (nTestCases--) { int nStudents = 0; scanf("%d", &nStudents); double* pStudentScores = new double[nStudents]; double fTotalScore = 0; for (int i=0; i<nStudents; ++i) { scanf("%lf", &pStudentScores[i]); fTotalScore += pStudentScores[i]; } double fAverageScore = fTotalScore / nStudents; int nGoodStudents = 0; for (int i=0; i<nStudents; ++i) { if (pStudentScores[i] > fAverageScore) { ++nGoodStudents; } } double fAboveAverage = (static_cast<double>(nGoodStudents) / nStudents)*100; printf("%.3f%%\n", fAboveAverage); } return 0; }
标签:style blog color io for ar 2014 div
原文地址:http://www.cnblogs.com/roronoa-zoro-zrh/p/3928574.html