We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

# Project Euler #29: Distinct powers

# Project Euler #29: Distinct powers

Contest ends in

#### Sort by

recency

#### |

#### 47 Discussions

#### |

Please Login in order to post a comment

## include

## include

## include

## include

## include

## include

using namespace std;

int main() { set terms; long n; cin>>n; for(long a = 2; a <= n; a++){ for(long b = 2; b <= n; b++){ long result = pow(a, b); terms.insert(result); } } long count=0; for(long term : terms){ count++; } cout<

Can anyone explain what's wrong in my code? Only sample test case 0 successfully ran, and all remaining test cases were unsuccessful."

I cannot able to understand these problem