Submission #20237

# Submission time Handle Problem Language Result Execution time Memory
20237 2016-06-18T06:29:42 Z sui 동전 (kriii4_E) C++14
100 / 100
49 ms 1 KB
#define _CRT_SECURE_NO_WARNINGS // scanf(), gets() (needed for Visual C++)

#include <cassert>

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>

using namespace std;

#define MEMSET(x, WITH) memset(x, (WITH), sizeof(x))
#define FOR(i, E) for (int i=0; i<(E); i++)

typedef long long ll;
const ll MOD = 1000000007;
//const double PI = atan(1) * 4;










const int BIT = 1<<8;

int N;
ll dp[253][2][BIT];

int main() {
	cin >> N;

	dp[0][0][0] = 1;

	dp[1][0][0] = 1;
	dp[1][1][1] = 1;
	
	for (int n=2; n<=N; n++) {
		FOR(x, BIT) dp[n][0][x] = (dp[n-1][0][x] + dp[n-1][1][x]) % MOD;

		FOR(x, BIT) for (int t=1; t<=n; t++)
			dp[n][1][x] += dp[n-t][0][x^t],
			dp[n][1][x] %= MOD;
	}


	ll ans = (dp[N][0][0] + dp[N][1][0]) % MOD;
	cout << ans << endl;

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 0 KB Output is correct
2 Correct 1 ms 0 KB Output is correct
3 Correct 1 ms 0 KB Output is correct
4 Correct 1 ms 0 KB Output is correct
5 Correct 1 ms 0 KB Output is correct
6 Correct 2 ms 0 KB Output is correct
7 Correct 1 ms 0 KB Output is correct
8 Correct 1 ms 0 KB Output is correct
9 Correct 1 ms 0 KB Output is correct
10 Correct 1 ms 0 KB Output is correct
11 Correct 2 ms 0 KB Output is correct
12 Correct 1 ms 0 KB Output is correct
13 Correct 2 ms 0 KB Output is correct
14 Correct 1 ms 0 KB Output is correct
15 Correct 2 ms 0 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 0 KB Output is correct
2 Correct 27 ms 0 KB Output is correct
3 Correct 2 ms 0 KB Output is correct
4 Correct 8 ms 0 KB Output is correct
5 Correct 5 ms 0 KB Output is correct
6 Correct 10 ms 0 KB Output is correct
7 Correct 34 ms 1 KB Output is correct
8 Correct 41 ms 1 KB Output is correct
9 Correct 13 ms 1 KB Output is correct
10 Correct 43 ms 1 KB Output is correct
11 Correct 8 ms 1 KB Output is correct
12 Correct 8 ms 1 KB Output is correct
13 Correct 37 ms 1 KB Output is correct
14 Correct 25 ms 1 KB Output is correct
15 Correct 13 ms 1 KB Output is correct
16 Correct 3 ms 1 KB Output is correct
17 Correct 47 ms 1 KB Output is correct
18 Correct 3 ms 1 KB Output is correct
19 Correct 22 ms 1 KB Output is correct
20 Correct 5 ms 1 KB Output is correct
21 Correct 30 ms 1 KB Output is correct
22 Correct 24 ms 1 KB Output is correct
23 Correct 16 ms 1 KB Output is correct
24 Correct 11 ms 1 KB Output is correct
25 Correct 6 ms 1 KB Output is correct
26 Correct 3 ms 1 KB Output is correct
27 Correct 38 ms 1 KB Output is correct
28 Correct 2 ms 1 KB Output is correct
29 Correct 37 ms 1 KB Output is correct
30 Correct 49 ms 1 KB Output is correct