#include #include #include using namespace std; int main(){ ifstream is("yesorno.in"); if(!is){ cerr << "bad file" << endl; return 1; } int K; is >> K; for(int i=0; i < K; i++){ int l, r, n; is >> l >> r >> n; double y[400]; for(int q = 0; q < n; q++){ is >> y[q]; } sort(y, y + n); double score = 0, bestScore = 0; int numno; for(int numy = l; numy <= r; numy++){ numno = n - numy; score = 0; for(int j = 0; j < n; j++){ if( j < numno ){ score += 1-y[j]; } else{ score += y[j]; } } //cout << numy << ": score " << score << endl; bestScore = max(score, bestScore); } //cout << "Data Set " << i + 1 << endl << bestScore << endl; printf("Data Set %i:\n%.2f\n", i+1, bestScore); } return 0; }