| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

PE173_c

Page history last edited by Kenneth Finnegan 15 years, 7 months ago

// 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.