Submission #922646

#TimeUsernameProblemLanguageResultExecution timeMemory
922646rainboyOnes (LMIO17_vienetai)C11
100 / 100
1 ms600 KiB
#include <stdio.h> #define D 9 int main() { static int pp[D]; static long long ss[D]; int n, m, d, h, r, r_, c; long long sum; scanf("%d%d%d", &n, &m, &d); if (n % m != 0 || d % 2 == 0 || d % 5 == 0) { printf("NESIDALO\n"); return 0; } for (r = 0; r < d; r++) { r_ = r, c = 0; do ss[r] += r_ * 10 / d, r_ = r_ * 10 % d, c++; while (r_ != r); ss[r] *= (m - 1) / c; for (h = 0, r_ = r; h < (m - 1) % c; h++) ss[r] += r_ * 10 / d, r_ = r_ * 10 % d; ss[r] += (r_ * 10 + 1) / d, pp[r] = (r_ * 10 + 1) % d; } r = 0, c = 0, sum = 0; do sum += ss[r], r = pp[r], c++; while (r != 0); if (n / m % c != 0) printf("NESIDALO\n"); else { sum *= n / m / c; printf("%lld\n", sum); } return 0; }

Compilation message (stderr)

vienetai.c: In function 'main':
vienetai.c:11:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d%d%d", &n, &m, &d);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...