題目大意
定義,求,
解題分析
嗯……轉化一道就是求的組數,然後……玄學枚舉一下?
先枚舉最小的a,然後枚舉較大的b,統計最大的c個數,然後排列組合,分類討論瞭解一下?
時間複雜度,詭異……
示例代碼
#include<cstdio>
using namespace std;
typedef long long LL;
LL n; int tst;
LL _work(LL n){
LL ans=0;
for (LL a=1;a*a*a<=n;a++)
for (LL b=a;a*b*b<=n;b++){
LL c=n/(a*b); if (c<b) break;
if (a==b) ans+=(c-b)*3+1; else ans+=(c-b)*6+3;
}
return ans;
}
int main()
{
freopen("exam.in","r",stdin);
freopen("exam.out","w",stdout); tst=0;
while (scanf("%lld",&n)==1) printf("Case %d: %lld\n",++tst,_work(n));
return 0;
}