#include using namespace std; #define rep(i,a,b) for(int i=a;i> n; vector arr; int i = 1; while(i*(i+1)/2 <= n){ arr.push_back(i*(i+1)/2); i++; } if(binary_search(arr.begin(), arr.end(), n)){ cout << 1 << endl; return 0; } rep(i,0,arr.size()){ if(binary_search(arr.begin(), arr.end(), n - arr[i])){ cout << 2 << endl; return 0; } } cout << 3 << endl; }