Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## 我真就不明白了,拿我的程序测试的数据和别人AC的代码测试的数据吻合,为什么WA啊!!WA的吐血了,做了好几个题目都是这样,没信心了!

Posted by lovexinbao at 2011-05-11 09:36:10 on Problem 1091
```我测试
5 5
out 3124
10 10
out 9990233352

#include <iostream>
#include <vector>
#include<math.h>
using namespace std;
bool judgeprime(int m)
{
int x=0;
bool isprime=true;
for(int i=2;i<=sqrt(m*1.0);i++)
{
if(m%i==0)
{
isprime=false;
break;
}
}
return isprime;
}
int main()
{
int n,m;
__int64 result_number;
cin>>n>>m;
if(judgeprime(m)==true)
{
result_number=(pow(m*1.0,n*1.0)-1);
}
else
{
vector<int> prime;
for(int i=2;i<=m/2;i++)
{

if(m%i==0&&judgeprime(i)==true)
{
prime.push_back(m/i);
}
}
result_number=pow(m*1.0,n*1.0);
for(int i=0;i< prime.size();i++)
{
result_number-=pow(prime[i]*1.0,n*1.0);
}
result_number+=(prime.size()-1);
}
cout<<result_number<<endl;
system("pause")  ;
return 0;
}

Followed by: