Untitled

mail@pastecode.io avatar
unknown
plain_text
4 years ago
430 B
2
Indexable
Never
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>

signed main() {
	double res = 0;
	char c;
	long double id = 1;
	int xx = 0;
	while ((c = getc(stdin)) != EOF) {
		if (c == '(')
			id *= 2;
		if (c == ')')
			id /= 2;
		if (isdigit(c)) {
			ungetc(c, stdin);
			int y;
			scanf("%d", &y);
			res += (y * 1.) / id;
		}
	}
	printf("%.2lf", res);
}