Submission #19977

# Submission time Handle Problem Language Result Execution time Memory
19977 2016-02-25T08:05:53 Z sui 동전 (kriii4_E) C++14
100 / 100
54 ms 2728 KB
#define _CRT_SECURE_NO_WARNINGS // scanf(), gets() (needed for Visual C++)

//#define NDEBUG
#include <cassert>

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

#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <deque>

using namespace std;

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

#define GETINT(x) scanf("%d", &x)
#define GETDBL(x) scanf("%lf", &x)
#define GETSTR(x) scanf("%s", x)
#define NEWINT(x) int x; scanf("%d", &x)
#define NEWDBL(x) double x; scanf("%lf", &x)
#define NEWLN putchar('\n')

#ifdef _WIN32
#define popcnt __popcnt
#else
#define popcnt __builtin_popcount
#endif

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




int N;




ll dp[253][2][256];


int main() {
	cin >> N;


	/*
	ll pow2[253];
	pow2[0] = 1;
	for (int i=1; i<=N; i++) pow2[i] = pow2[i-1] * 2 % MOD;
	*/



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


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

	for (int i=1; i<=N; i++) {

		for (int firstStep=1; firstStep<=i; firstStep++) {
			for (int s=0; s<256; s++) {
				dp[i][1][firstStep^s] += dp[i-firstStep][0][s];
				dp[i][1][firstStep^s] %= MOD;

				dp[i][0][s] += dp[i-firstStep][1][s];
				dp[i][0][s] %= MOD;
			}
		}

	}





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


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