Untitled
unknown
plain_text
4 years ago
494 B
2
Indexable
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> signed main() { double res = 0; char c; int id = 1; int xx = 0; while ((c = getc(stdin)) != EOF) { if (c == '(') { xx++; if (xx < 23) id <<= 1; } if (c == ')') { xx--; if (xx < 23) id >>= 1; } if (isdigit(c)) { ungetc(c, stdin); int y; scanf("%d", &y); res += (y * 1.) / id; } } printf("%.2lf", res); }
Editor is loading...