How many kinds of GPA are enumerated?
Total score 1 + minimum score for this GPa
Total score 2 plus the maximum score of this GPa
If the total score is 1 <= input score × n <= total score 2
You can reach the target score in the enumerated status.
# Include <stdio. h> # include <string. h> # include <math. h ># include <string >#include <algorithm> using namespace STD; # define in freopen ("in.txt", "r", stdin ); # define out freopen ("out.txt", "W", stdout); typedef long ll; const int M = 100100; double getmin, getmax; double OK [5] = {2, 2.5, 3, 3.5, 4}; int Len [5] [2] = {60, 69}, {70, 74 }, {80, 84 },{ 85,100 }}; int N; void DFS (INT num, int tol1, int tol2, double Fen, int Cheng) {If (num = N & Cheng =-1 & tol1> = 0 & tol2 <= 0) {getmax = max (getmax, Fen ); getmin = min (getmin, Fen); return;} else if (Cheng> = 0) {for (INT I = 0; I <= N-num; I ++) {DFS (Num + I, tol1-len [Cheng] [0] * I, tol2-len [Cheng] [1] * I, Fen + OK [Cheng] * I, cheng-1) ;}}int main () {int t; scanf ("% d", & T); While (t --) {int Ave; getmax =-1, getmin = 10000; scanf ("% d", & Ave, & N); DFS (0, Ave * n, Ave * n,); printf ("%. 4lf %. 4lf \ n ", getmin/N, getmax/n);} return 0 ;}