Skip to content

Instantly share code, notes, and snippets.

@Doaxan
Created September 4, 2018 10:38
Show Gist options
  • Select an option

  • Save Doaxan/81b18490f3d4a30356cc62bd5a7dce2e to your computer and use it in GitHub Desktop.

Select an option

Save Doaxan/81b18490f3d4a30356cc62bd5a7dce2e to your computer and use it in GitHub Desktop.
c_fast_6sec
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main() {
int count = 0;
for (int k = 2; k < 3; k++) {
for (int x = 1; x < 101; x++) {
for (int a = 1; a < 101; a++) {
for (int b = 1; b < 101; b++) {
for (int c = 1; c < 101; c++) {
for (int d = 1; d < 101; d++) {
if (pow(x, k) == pow(a, k) + pow(b, k) + pow(c, k) + pow(d, k)) {
count++;
}
}
}
}
}
}
}
printf("%d", count);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment