// Solution to Project Euler problem 173
// square lamina with square hole
#include <stdio.h>
#include <stdint.h>
#define TILES 1000000
main() {
int count = 0;
int i, j;
for (i=3; i<=TILES/4+1; i++) {
for (j=i-2; j>0; j-=2) {
uint64_t area = i * i - j * j;
if (area <= TILES) {
count++;
} else
break;
}
}
printf("Solution: %d\n", count);
}
Comments (0)
You don't have permission to comment on this page.