Task: | Lukujono |
Sender: | motsgar |
Submission time: | 2021-12-09 15:06:42 +0200 |
Language: | C++ (C++17) |
Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'll f(int)': input/code.cpp:14:17: error: 'j' was not declared in this scope if (num[i / j] != 0) ^
Code
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1 << 8; ll num[N]; ll f(int i) { if (i == 0) return 0; if (i == 1) return 1; if (num[i / j] != 0) { return num[i / j]; } ll s = 0; int j = 2; while (j <= i) { ll r = f(i / j); num[i / j] = r; s += r; j++; } return s; } int main(int argc, char **argv) { ios_base::sync_with_stdio(false); cin.tie(NULL); int i; cin >> i; cout << f(i) << "\n"; }