코딩
-
미로찾기코딩/C언어 2019. 9. 17. 15:26
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 #include #define WIDTH 10 #define HEIGHT 10 int screen[WIDTH][HEIGHT] = { 0, 0, 0,-1,-1,-1,-1,-1,-1,-1, -1,-1, 0,-1,-1,-1,-1,-1,-1,-1, -1, 0, 0, 0, 0, 0, 0,-1,-1,-1, -1,-1,-1,-1, 0,-1, 0,-1,-1,-1, -1,-1,-1,-1, 0,-1, 0,..
-
받아올림의 개수코딩/C언어 2019. 9. 17. 15:08
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 #include int main(void) { int num, num1, num2, result = 0, i = 0; scanf("%d %d", &num1, &num2); while (num1 > 0 || num2 > 0) { num = num1 % 10 + num2 % 10; if (i == 1) { num++; i = 0; } if (num >= 10) { result++; i = 1; } num1 /= 10; num2 /= 10; } printf("%d", result); } Colored by Color Scripter cs 결과:
-
palindrome 판별 (대소문자 구분X)코딩/C언어 2019. 9. 17. 14:46
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 #include int isPalindrome(char s[]) { int i, j, k = 0; char str[30]; for (i = 0; s[i] != '\0'; i++) { if (isupper(s[i])) { str[k] = tolower(s[i]); k++; } else if (isalpha(s[i])) { str[k] = s[i]; k++; } } str[k] = '\0'; for (j = 0; j
-
제켄도르프 정리코딩/C언어 2019. 9. 17. 14:33
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 #include int main(void) { int num, i, result; scanf("%d", &num); printf("%d", Zeck(num)); } int Zeck(int n) { int i, result = 0; if (n == 1) return 2; for (i = 0; i