提交时间:2021-05-19 17:43:03

运行 ID: 19676

#include<bits/stdc++.h> using namespace std; int n,ls,s=1; bool wms(int w) { int sum=0; for(int i=1; i*i<=w; i++)if(w%i==0)sum+=i+(w/i); if(w==sum)return 1; return 0; } int main() { cin>>n; for(int i=1;ls<=n;i+=2) { ls+=i*i*i; if(wms(ls)&&ls<=n)s++; } cout<<s<<endl; }