답안 #212108

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
212108 2020-03-22T09:37:52 Z Kalam Zapina (COCI20_zapina) C++11
110 / 110
169 ms 1656 KB
// KALAM
# include<bits/stdc++.h>

using namespace std;

const int N = 300 + 77 , Mod = 1000000007;
int n , A , dp[N][N] , C[N][N];
int main() {
   for(int i = 0;i < N;++ i)
      C[0][i] = C[i][i] = 1;
   for(int i = 1;i < N;++ i)
      for(int j = i + 1;j < N;++ j)
         C[i][j] = (C[i - 1][j - 1] + C[i][j - 1]) % Mod;
   scanf("%d" , & n);
   dp[0][0] = 1;
   for(int i = 1;i <= n;++ i)
      for(int j = 0;j <= n;++ j)
         for(int k = 0;k <= j;++ k)
            if(k != i) {
               dp[i][j] = (dp[i][j] + C[k][n - j + k] * 1ll * dp[i - 1][j - k]) % Mod;
            }
   A = 1;
   for(int i = 1;i <= n;++ i)
      A = A * 1ll * n % Mod;
   A = (A + Mod - dp[n][n]) % Mod;
   printf("%d\n" , A);
   return 0;
}

Compilation message

zapina.cpp: In function 'int main()':
zapina.cpp:14:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d" , & n);
    ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 896 KB Output is correct
2 Correct 5 ms 896 KB Output is correct
3 Correct 5 ms 896 KB Output is correct
4 Correct 5 ms 896 KB Output is correct
5 Correct 5 ms 896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 896 KB Output is correct
2 Correct 5 ms 896 KB Output is correct
3 Correct 5 ms 896 KB Output is correct
4 Correct 5 ms 896 KB Output is correct
5 Correct 5 ms 896 KB Output is correct
6 Correct 5 ms 896 KB Output is correct
7 Correct 5 ms 896 KB Output is correct
8 Correct 5 ms 896 KB Output is correct
9 Correct 5 ms 896 KB Output is correct
10 Correct 5 ms 896 KB Output is correct
11 Correct 5 ms 896 KB Output is correct
12 Correct 5 ms 768 KB Output is correct
13 Correct 6 ms 896 KB Output is correct
14 Correct 5 ms 896 KB Output is correct
15 Correct 6 ms 896 KB Output is correct
16 Correct 5 ms 896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 896 KB Output is correct
2 Correct 5 ms 896 KB Output is correct
3 Correct 5 ms 896 KB Output is correct
4 Correct 5 ms 896 KB Output is correct
5 Correct 5 ms 896 KB Output is correct
6 Correct 5 ms 896 KB Output is correct
7 Correct 5 ms 896 KB Output is correct
8 Correct 5 ms 896 KB Output is correct
9 Correct 5 ms 896 KB Output is correct
10 Correct 5 ms 896 KB Output is correct
11 Correct 5 ms 896 KB Output is correct
12 Correct 5 ms 768 KB Output is correct
13 Correct 6 ms 896 KB Output is correct
14 Correct 5 ms 896 KB Output is correct
15 Correct 6 ms 896 KB Output is correct
16 Correct 5 ms 896 KB Output is correct
17 Correct 83 ms 1272 KB Output is correct
18 Correct 6 ms 896 KB Output is correct
19 Correct 21 ms 1152 KB Output is correct
20 Correct 5 ms 896 KB Output is correct
21 Correct 109 ms 1272 KB Output is correct
22 Correct 16 ms 1152 KB Output is correct
23 Correct 6 ms 1024 KB Output is correct
24 Correct 27 ms 1152 KB Output is correct
25 Correct 20 ms 1152 KB Output is correct
26 Correct 35 ms 1152 KB Output is correct
27 Correct 154 ms 1400 KB Output is correct
28 Correct 161 ms 1400 KB Output is correct
29 Correct 164 ms 1400 KB Output is correct
30 Correct 159 ms 1400 KB Output is correct
31 Correct 160 ms 1400 KB Output is correct
32 Correct 161 ms 1528 KB Output is correct
33 Correct 162 ms 1400 KB Output is correct
34 Correct 165 ms 1400 KB Output is correct
35 Correct 169 ms 1656 KB Output is correct
36 Correct 169 ms 1400 KB Output is correct
37 Correct 167 ms 1400 KB Output is correct