about summary refs log tree commit diff
path: root/codeforces/697b.c
blob: a41cf7f2f66a46c2da22461245a63a68e3a3b9bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

int main()
{
	char a, d[100], b, i, bgun = 0;

	scanf("%hhd.%s", &a, d);
	for (i = 0; i < strlen(d); i++)
		if (d[i] == 101) {
			b = atoi(d + i + 1);
			d[i] = 0;
		}

	if (a) {
		printf("%hhd", a);
		bgun = 1;
	}

	for (i = 0; i < b; i++) {
		a = (i < strlen(d)) ? d[i] : 48;
		if (bgun || a ^ 48) {
			putchar(a);
			bgun = 1;
		}
	}
	
	if (!bgun)
		putchar(48);

	if (i < strlen(d) && (d[i] ^ 48 || strlen(d) ^ 1)) {
		putchar(46);
		for (; i < strlen(d); i++)
			putchar(d[i]);
	}

	putchar(10);

	return 0;
}