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.
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."
Project Euler #29: Distinct powers
You are viewing a single comment's thread. Return to all comments →
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."