Created
April 30, 2014 13:10
-
-
Save knowlet/fed8f1ba8150fd22262c to your computer and use it in GitHub Desktop.
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 <string.h> | |
const char *wtfPerfectNum[] = {"6", "28", "496", "8128", "33550336", "8589869056", "13743869132"}; | |
int isPerfect(char* num) | |
{ | |
int i = 7; | |
while (i--) if (!strcmp(num, wtfPerfectNum[i])) return 1; | |
return 0; | |
} | |
int main(int argc, char *argv[]) { | |
int n; | |
char p[17]; | |
scanf("%d", &n); | |
while (n--) { | |
scanf("%s", p); | |
puts(isPerfect(p) ? "perfect" : "nonperfect"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment