# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
72470 | um.. (#118) | 디스토브 (FXCUP3_dstorv) | C++11 | 2 ms | 484 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
using namespace std;
int main() {
int N, r, h, A, B;
scanf("%d %d %d", &N, &r, &h);
char *chk = (char*)malloc(sizeof(char) * N);
scanf("%s", chk);
scanf("%d %d", &A, &B);
int len = strlen(chk);
int num_R = 0;
int num_H = 0;
for(int i = 0; i < len; i++){
if(chk[i] == 'R') num_R++;
else if(chk[i] == 'H') num_H++;
}
num_R -= A;//�������� ��
num_H -= B;//R�� H�� ����
long long up = pow(r, num_R) + pow(h, num_H);
long long down = pow((r + h), (num_R + num_H));
long long a = up;
long long gcd = down;
while(a != 0){
long long swap = a;
a = gcd % a;
gcd = swap;
}
up /= gcd;
down /= gcd;
long long ten_9 = pow(10, 9);
long long res;
for(int i = 1; i < 15; i++){
if((((ten_9 + 7) * i + up) % down) == 0){
res = ((ten_9 + 7) * i + up) / down;
}
}
printf("%lld\n", res);
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... |