Submission #72046

#TimeUsernameProblemLanguageResultExecution timeMemory
72046Semteo For Ajou (#118)Dstorv (FXCUP3_dstorv)C++17
0 / 100
2 ms360 KiB
#include <stdio.h> char inp[5000]; unsigned long long GCD(unsigned long long p, unsigned long long q) { unsigned long long mo; while (q != 0) { mo = p % q; p = q; q = mo; } return p; } int main() { int n, r, h, A, B, i, cnta, cntb; unsigned long long p, q, t, k; scanf("%d %d %d", &n, &r, &h); scanf("%s", inp); scanf("%d %d", &A, &B); cnta = cntb = 0; for (i = 0; i < n; i++) { if (inp[i] == 'R') cnta++; else if (inp[i] == 'H') cntb++; } cnta = cnta - A; cntb = cntb - B; p = q = 1; for (i = 1; i <= cnta; i++) { t=GCD(r, r + h); p = p * (r / t); q = q * ((r + h) / t); t = GCD(p, q); p = p / t; q = q / t; } for (i = 1; i <= cntb; i++) { t = GCD(h, r + h); p = p * (h / t); q = q * ((r + h) / t); t = GCD(p, q); p = p / t; q = q / t; } k = 1000000007 + p; t = GCD(k, q); k = k / t; q = q / t; printf("%lld", k*q); return 0; }

Compilation message (stderr)

dstorv.cpp: In function 'int main()':
dstorv.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d", &n, &r, &h);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
dstorv.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s", inp);
  ~~~~~^~~~~~~~~~~
dstorv.cpp:18:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &A, &B);
  ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...