Submission #370759
Source Code Expand
#include <algorithm>
#include <stdio.h>
#include <string>
#include <iostream>
#include <map>
#include <math.h>
using namespace std;
#define MAX1 (100)
#define MAX2 (100)
#define MP make_pair
#define REP(i, n) for(i = 0; i < n; i++)
typedef pair<int, int> pii;
typedef pair<int, pii> pip;
typedef pair<pii, pii> ppp;
typedef long long ll;
int N;
long int D, X, Y;
int dp[2001][2001][2001];
int dfs(
int nowN,
int nowX,
int nowY)
{
int count = 0;
if ( nowN == 0 && nowX == X && nowY == Y )
return 1;
if ( nowN == 0 )
return 0;
if ( dp[nowN+1000][nowX+1000][nowY+1000] != 0 )
return dp[nowN+1000][nowX+1000][nowY+1000];
// 4 方向に向かう
count += dfs(nowN-1, nowX-1, nowY);
count += dfs(nowN-1, nowX+1, nowY);
count += dfs(nowN-1, nowX, nowY-1);
count += dfs(nowN-1, nowX, nowY+1);
dp[nowN+1000][nowX+1000][nowY+1000] = count;
return count;
}
int main (void)
{
int count;
cin >> N >> D >> X >> Y;
if ( X % D == 0 && Y % D == 0 ) {
X /= D;
Y /= D;
count = dfs(N, 0, 0);
}
else {
count = 0;
}
printf("%8f\n", (double)count / pow(4.0, N));
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - 大ジャンプ |
| User | aiki |
| Language | C++ (G++ 4.6.4) |
| Score | 0 |
| Code Size | 1326 Byte |
| Status | CE |
Compile Error
/tmp/ccvqPOI9.o: In function `dfs(int, int, int)': Main.cpp:(.text+0x2d): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/ccvqPOI9.o Main.cpp:(.text+0xf0): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/ccvqPOI9.o /tmp/ccvqPOI9.o: In function `main': Main.cpp:(.text.startup+0x2): relocation truncated to fit: R_X86_64_32 against symbol `N' defined in .bss section in /tmp/ccvqPOI9.o Main.cpp:(.text.startup+0x13): relocation truncated to fit: R_X86_64_32 against symbol `D' defined in .bss section in /tmp/ccvqPOI9.o Main.cpp:(.text.startup+0x20): relocation truncated to fit: R_X86_64_32 against symbol `X' defined in .bss section in /tmp/ccvqPOI9.o Main.cpp:(.text.startup+0x2d): relocation truncated to fit: R_X86_64_32 against symbol `Y' defined in .bss section in /tmp/ccvqPOI9.o Main.cpp:(.text.startup+0x3c): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/ccvqPOI9.o Main.cpp:...