aboutsummaryrefslogtreecommitdiff
path: root/codeforces
diff options
context:
space:
mode:
Diffstat (limited to 'codeforces')
-rw-r--r--codeforces/697a.c17
-rw-r--r--codeforces/697b.c41
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;
+}