Project Euler #29: Distinct powers

  • + 1 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."