From 2a7bc10f6c011d19fb3b0e73068f7e1a9c30ace0 Mon Sep 17 00:00:00 2001 From: Raphael McSinyx Date: Sat, 8 Oct 2016 09:56:43 +0700 Subject: Initial commit --- codeforces/697a.c | 17 +++++++++++++++++ codeforces/697b.c | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 codeforces/697a.c create mode 100644 codeforces/697b.c (limited to 'codeforces') 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 + +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 +#include +#include + +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; +} -- cgit 1.4.1