diff options
author | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2016-10-08 09:56:43 +0700 |
---|---|---|
committer | Raphael McSinyx <vn.mcsinyx@gmail.com> | 2016-10-08 09:56:43 +0700 |
commit | 2a7bc10f6c011d19fb3b0e73068f7e1a9c30ace0 (patch) | |
tree | 95190a32ec1c7098494849eea5a5ba6b53289585 /codeforces | |
parent | 207cc2ae9893b0cdecd20119b9ede37f73cd4a1e (diff) | |
download | cp-2a7bc10f6c011d19fb3b0e73068f7e1a9c30ace0.tar.gz |
Initial commit
Diffstat (limited to 'codeforces')
-rw-r--r-- | codeforces/697a.c | 17 | ||||
-rw-r--r-- | codeforces/697b.c | 41 |
2 files changed, 58 insertions, 0 deletions
diff --git a/codeforces/697a.c b/codeforces/697a.c new file mode 100644 index 0000000..576bc59 --- /dev/null +++ b/codeforces/697a.c @@ -0,0 +1,17 @@ +#include <stdio.h> + +int main() +{ + long t, s, x; + + scanf("%ld %ld %ld", &t, &s, &x); + + x -= t; + + if (((x % s == 1) && (x / s > 0)) || ((x % s == 0) && (x / s >= 0))) + puts("YES"); + else + puts("NO"); + + return 0; +} diff --git a/codeforces/697b.c b/codeforces/697b.c new file mode 100644 index 0000000..a41cf7f --- /dev/null +++ b/codeforces/697b.c @@ -0,0 +1,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; +} |