//UVa815 - Flooded! #include<iostream> #include<algorithm> int M, N, W, S[1000], T = 0; intmain() { //freopen("in.txt", "r", stdin); while (scanf("%d%d", &M, &N) != -1 && M != 0 && N != 0) { for (int i = 0, *p = S;i < M*N;++i) scanf("%d", p++); scanf("%d", &W); std::sort(S, S + M*N); int i, water = 0; for (i = 1;i < M*N;++i) { int t = water + i*(S[i] - S[i - 1]) * 100; if (t >= W) break; water = t; } float level = (float)(W - water) / (float)(i * 100) + S[i - 1]; printf("Region %d\nWater level is %.2f meters.\n", ++T, level); printf("%.2f percent of the region is under water.\n\n", (float)(i * 100) / (float)(M*N)); } return0; }