Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include <stdbool.h>
- /**
- * Auto-generated code below aims at helping you parse
- * the standard input according to the problem statement.
- **/
- int main()
- {
- int M;
- scanf("%d", &M); fgetc(stdin);
- int T[100][15] = {{0}};
- float TC = 0;
- float TC2 = 0;
- fprintf(stderr, "M=%d\n", M);
- int d = 0;
- for (int i = 0; i < M; i++) {
- char LINE[45];
- fgets(LINE, 45, stdin);
- char *p = LINE;
- int k = 0;
- int n;
- int s = 0;
- while (sscanf(p, "%d %n" , &T[i - d][k], &n) == 1) {
- p += n;
- s += T[i - d][k];
- k += 1;
- }
- if (s == 0)
- d += 1;
- }
- M -= d;
- for (int k = 0; k < M; k += 1) {
- fprintf(stderr, "T[%d] = [", k);
- for (int j = 0; j < 15; j += 1) {
- fprintf(stderr, "%d%s", T[k][j], j == 14 ? "" : ", ");
- }
- fprintf(stderr, "]\n", k);
- }
- for (int k = 0; k < M; k += 1) {
- float s = 0;
- for (int j = 0; j < 15; j += 1) {
- s += T[k][j];
- }
- TC += 10 + (s - 40) / 7;
- }
- int k = 0;
- float s = 0;
- int m = M * 15;
- if (m % 2 == 1)
- m -= 1;
- while (k < m) {
- s += T[k / 15][k % 15];
- if (k % 2 == 0)
- s += 5;
- k += 1;
- }
- fprintf(stderr, "total = %f\n", TC / M);
- printf("%0.1f\n", TC / M);
- if (TC / M >= 5 && TC / M <= 30)
- printf("%.1f\n", s / m * 2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement