Created
August 7, 2017 14:19
-
-
Save lstar2397/ddde7608ef05a66f5f57c04d4a307921 to your computer and use it in GitHub Desktop.
[NYPC2016_예선문제] "마비노기 듀얼: 올바른 덱인가요?" 풀이
This file contains hidden or 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> | |
| int main() | |
| { | |
| // 0 - gold, 1 - light, 2 - mana, 3 - nature, 4 - dark | |
| int resource[5] = { 0, }, resourceCount = 0; | |
| int deckSize; | |
| scanf("%d", &deckSize); | |
| if (deckSize > 12) return; | |
| for (int i = 0; i < deckSize; i++) | |
| { | |
| char str[10]; | |
| scanf("%s", str); | |
| if (strcmp(str, "gold") == 0) | |
| resource[0]++; | |
| else if (strcmp(str, "light") == 0) | |
| resource[1]++; | |
| else if (strcmp(str, "mana") == 0) | |
| resource[2]++; | |
| else if (strcmp(str, "nature") == 0) | |
| resource[3]++; | |
| else if (strcmp(str, "dark") == 0) | |
| resource[4]++; | |
| } | |
| for (int i = 0; i < 5; i++) | |
| { | |
| if (resource[i] > 0) | |
| resourceCount++; | |
| } | |
| if (resourceCount > 3) | |
| printf("invalid"); | |
| else | |
| printf("valid"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment