| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:公式的推导In Reply To:公式的推导 Posted by:Ly86 at 2010-04-25 19:03:36 推导有一点点问题,应该是(a+0.5*k)(k+1)=n推出(2*a+k)(k+1)=2n,这个式子左边的两个因子1奇1偶,但是不确定,等价于求2*n的奇因子或偶因子的个数,而2*n的奇因子个数等于n的奇因子个数,因此最后结论还是求n的奇因子个数
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
long long n;
cin>>n;
int cnt=0;
for(int i=1;i<=n;i=i+2)
{
if(n%i==0)
cnt++;
}
cout<<cnt<<endl;
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator