This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> | |
int columns[8] = {-1,-1,-1,-1,-1,-1,-1,-1}; | |
int num_solutions = 0; | |
void print_queens() { | |
for(int y = 0; y < 8; y++) { | |
for(int x = 0; x < 8; x++) { | |
putchar(columns[x] == y ? 'Q' : '.'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ctype.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
typedef enum { | |
SUCCESS, // parsed | |
FAILURE, // didn't parse | |
ERROR // bad syntax | |
} status; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func isLeap(y int) bool { | |
if y%4 == 0 { | |
if y%100 == 0 { | |
return y%400 == 0 | |
} | |
return true | |
} | |
return false | |
} |
OlderNewer