fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define FOR(i, N) for(int i = 0; i < N; i++)
  6. #define FOR1e(i, N) for(int i = 1; i <= N; i++)
  7. #define REP(i, M, N) for(int i = M; i < N; i++)
  8. #define REPe(i, M, N) for(int i = M; i <= N; i++)
  9. #define all(s) s.begin(), s.end()
  10. #define gt(s) getline(cin, s)
  11. #define ms(a, v) memset(a, v, sizeof a)
  12. #define mp make_pair
  13.  
  14. typedef long long ll;
  15. typedef pair<int, int> pii;
  16. typedef vector<int> vi;
  17.  
  18. const int oo = 1 << 30;
  19. const int MAX = 1e5 + 1;
  20. const int MOD = 1e9 + 7;
  21.  
  22. int dr[] = { 0, -1, 0, 1 };
  23. int dc[] = { 1, 0, -1, 0 };
  24.  
  25. inline int Pow(int b, int p) { if (!p) return 1; int sq = Pow(b, p >> 1); sq *= sq; if (p & 1) sq *= b; return sq; }
  26. inline int gcd(int a, int b) { if (!a) return b; return gcd(b % a, a); }
  27. inline string toString(int x) { stringstream SS; SS << x; return SS.str(); }
  28.  
  29. int n, k;
  30. int dp[101][MAX];
  31.  
  32. int solve(int i, int prev){
  33. if (i == n)
  34. return 1;
  35.  
  36. int &ret = dp[i][prev];
  37. if (ret != -1)
  38. return ret;
  39.  
  40. ret = 0;
  41.  
  42. if (!i){
  43. FOR1e(j, k){
  44. ret = (ret % MOD + solve(i + 1, j) % MOD) % MOD;
  45. }
  46. }
  47. else{
  48. bool b = 0;
  49. FOR1e(j, k){
  50. if (j >= prev || prev % j != 0){
  51. ret = (ret % MOD + solve(i + 1, j) % MOD) % MOD;
  52. b = 1;
  53. }
  54. }
  55.  
  56. if (!b)
  57. return ret = 0;
  58. }
  59.  
  60. return ret;
  61. }
  62.  
  63. class DivFreed2 {
  64. public:
  65. int count(int N, int K) {
  66. n = N; k = K;
  67. ms(dp, -1);
  68.  
  69. return solve(0, MAX - 1);
  70. }
  71. };
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/lib/gcc/i586-linux-gnu/5/../../../i386-linux-gnu/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty