# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
72470 | 2018-08-26T08:24:37 Z | um..(#2163, grape, sssyyy, arpiel0610) | Dstorv (FXCUP3_dstorv) | C++11 | 2 ms | 484 KB |
#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; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 248 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 484 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 248 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |