哪位高人帮忙看一下,求完全数程序用vc++2010编译后执行速度比devcpp还慢是什么原因?
vc++2010中源代码// 完全数.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <cstdlib>
#include <iostream>
#include <math.h>
#include <time.h>
using namespace std;
int wqs(long long n,long long *a)
{
long long i,j,k,l;
double x,z;
int r;
z=n;
x=sqrt(z);l=(long long)x+1;
//cout<<"1";
a[1]=1;r=1;
i=1;
while (i<l)
{
i++;
while ((n%i)==0)
{
n=n/i;
//cout<<"x"<<i;
r++;
a[r]=i;
}
x=sqrt(1.0*n);l=(long long)x+1;
}
if(n>1)
{
r++;
a[r]=n;
}
//cout<<"x"<<n;
return r;
}
int ysfj(long long n,long long *a)
{
long long i,j,k,l;
int r;
a[1]=1;r=1;
i=1;
l=n/2;
while (i<l)
{
i++;
if((n%i)==0)
{
r++;
a[r]=i;
}
}
return r;
}
int main(int argc, char *argv[])
{
clock_t begin,end;
double t1;
long long *a;
long long m,n,h,w;
int i,k,r;
cout<<"n=";
cin>>n;
cout<<endl;
begin=clock();
a=new long long[10000];
r=wqs(n,a);
cout<<n<<" = ";
for(i=1;i<=r;i++)
{
if(i==1) cout<<a[i];else cout<<" x "<<a[i];
}
cout<<endl;
cout<<endl;
h=0;
while(h<n)
{
h++;
r=ysfj(h,a);
w=0;
for(k=1;k<=r;k++)
{
w=w+a[k];
}
if (w==h)
{
cout<<h<<" = ";
for(i=1;i<=r;i++)
{
if(i==1) cout<<a[i];else cout<<" + "<<a[i];
}
cout<<endl;
}
}
end=clock();
t1=(double)(end-begin)/CLOCKS_PER_SEC;
cout<<"t1="<<t1<<endl;
delete[] a;
system("pause");
return 0;
}