# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
72046 | Semteo For Ajou (#118) | 디스토브 (FXCUP3_dstorv) | C++17 | 2 ms | 360 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |