Submission #19902

#TimeUsernameProblemLanguageResultExecution timeMemory
19902gs13068동전 (kriii4_E)C++98
100 / 100
95 ms1636 KiB
#include <cstdio> #include <map> const int p = 1000000007; using namespace std; int pw(int x, int y) { return y & 1 ? (long long)pw(x, y ^ 1)*x%p : y ? pw((long long)x*x%p, y >> 1) : 1; } int a[255]; int d[255][555]; int main() { int i, j, k, n; scanf("%d", &n); a[0] = 0; d[0][0] = 1; a[1] = 1; d[1][0] = 1; d[1][1] = 1; for (i = 2; i <= n; i++) { for (j = 0; j < i; j++) for (k = 0; k < 555; k++) (d[i][k ^ a[j]] += d[i - j - 1][k]) %= p; for (a[i] = 0; d[i][a[i]]; a[i]++); d[i][a[i]] = 1; } printf("%d", d[n][0]); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...