코딩도장

코딩도장

변경이력

돌아가기
3 8개 문자 추가 9개 문자 삭제

2016年12月23日 08:30

디디

### C(11) gcc -std=c11 ```{.cpp} #include <stdio.h> #include <string.h> #include <stdbool.h> // 문자->정수 inline static int ctoi(char c) { return c - '0'; } // 0~9까지 숫자가 한번씩만 사용했는지 bool is_duplicate(char *str); int main(void) { char temp[80]; while (scanf("%s", temp) == 1) printf("%s\n", is_duplicate(temp) ? "true" : "false"); return 0; } bool is_palindromduplicate(char *str) { if (strlen(str) != 10) return false; int number[10] = {[0] = 0}; while (*str) ++number[ctoi(*str++)]; for (int i=0; i<10; ++i) if (number[i] != 1) return false; return true; } ```
### C(11) gcc -std=c11 ```{.cpp} #include <stdio.h> #include <string.h> #include <stdbool.h> // 문자->정수 inline static int ctoi(char c) { return c - '0'; } // 0~9까지 숫자가 한번씩만 사용했는지 bool is_duplicate(char *str); int main(void) { char temp[80]; while (scanf("%s", temp) == 1) printf("%s\n", is_duplicate(temp) ? "true" : "false"); return 0; } bool is_palindromduplicate(char *str) { if (strlen(str) != 10) return false; int number[10] = {[0] = 0}; while (*str) ++number[ctoi(*str++)]; for (int i=0; i<10; ++i) if (number[i] != 1) return false; return true; } ```
### C(11) gcc -std=c11 ```{.cpp} #include <stdio.h> #include <string.h> #include <stdbool.h> // 문자->정수 inline static int ctoi(char c) { return c - '0'; } // 0~9까지 숫자가 한번씩만 사용했는지 bool is_duplicate(char *str); int main(void) { char temp[80]; while (scanf("%s", temp) == 1) printf("%s\n", is_duplicate(temp) ? "true" : "false"); return 0; } bool is_palindromduplicate(char *str) { if (strlen(str) != 10) return false; int number[10] = {[0] = 0}; while (*str) ++number[ctoi(*str++)]; for (int i=0; i<10; ++i) if (number[i] != 1) return false; return true; } ```
2 16개 문자 추가 18개 문자 삭제

2016年12月23日 08:30

디디

### C(11) gcc -std=c11 ```{.cpp} #include <stdio.h> #include <string.h> #include <stdbool.h> // 문자->정수 inline static int ctoi(char c) { return c - '0'; } // 0~9까지 숫자가 한번씩만 사용했는지 bool is_palindromduplicate(char *str); int main(void) { char temp[80]; while (scanf("%s", temp) == 1) printf("%s\n", is_palindromduplicate(temp) ? "true" : "false"); return 0; } bool is_palindrome(char *str) { if (strlen(str) != 10) return false; int number[10] = {[0] = 0}; while (*str) ++number[ctoi(*str++)]; for (int i=0; i<10; ++i) if (number[i] != 1) return false; return true; } ```
### C(11) gcc -std=c11 ```{.cpp} #include <stdio.h> #include <string.h> #include <stdbool.h> // 문자->정수 inline static int ctoi(char c) { return c - '0'; } // 0~9까지 숫자가 한번씩만 사용했는지 bool is_palindromduplicate(char *str); int main(void) { char temp[80]; while (scanf("%s", temp) == 1) printf("%s\n", is_palindromduplicate(temp) ? "true" : "false"); return 0; } bool is_palindrome(char *str) { if (strlen(str) != 10) return false; int number[10] = {[0] = 0}; while (*str) ++number[ctoi(*str++)]; for (int i=0; i<10; ++i) if (number[i] != 1) return false; return true; } ```
### C(11) gcc -std=c11 ```{.cpp} #include <stdio.h> #include <string.h> #include <stdbool.h> // 문자->정수 inline static int ctoi(char c) { return c - '0'; } // 0~9까지 숫자가 한번씩만 사용했는지 bool is_palindromduplicate(char *str); int main(void) { char temp[80]; while (scanf("%s", temp) == 1) printf("%s\n", is_palindromduplicate(temp) ? "true" : "false"); return 0; } bool is_palindrome(char *str) { if (strlen(str) != 10) return false; int number[10] = {[0] = 0}; while (*str) ++number[ctoi(*str++)]; for (int i=0; i<10; ++i) if (number[i] != 1) return false; return true; } ```
1 Original

2016年12月23日 08:04

디디

### C(11) gcc -std=c11 ```{.cpp} #include <stdio.h> #include <string.h> #include <stdbool.h> // 문자->정수 inline static int ctoi(char c) { return c - '0'; } // 0~9까지 숫자가 한번씩만 사용했는지 bool is_palindrome(char *str); int main(void) { char temp[80]; while (scanf("%s", temp) == 1) printf("%s\n", is_palindrome(temp) ? "true" : "false"); return 0; } bool is_palindrome(char *str) { if (strlen(str) != 10) return false; int number[10] = {[0] = 0}; while (*str) ++number[ctoi(*str++)]; for (int i=0; i<10; ++i) if (number[i] != 1) return false; return true; } ```
### C(11) gcc -std=c11 ```{.cpp} #include <stdio.h> #include <string.h> #include <stdbool.h> // 문자->정수 inline static int ctoi(char c) { return c - '0'; } // 0~9까지 숫자가 한번씩만 사용했는지 bool is_palindrome(char *str); int main(void) { char temp[80]; while (scanf("%s", temp) == 1) printf("%s\n", is_palindrome(temp) ? "true" : "false"); return 0; } bool is_palindrome(char *str) { if (strlen(str) != 10) return false; int number[10] = {[0] = 0}; while (*str) ++number[ctoi(*str++)]; for (int i=0; i<10; ++i) if (number[i] != 1) return false; return true; } ```
코딩도장

코딩도장은 프로그래밍 문제풀이를 통해서 코딩 실력을 수련(Practice)하는 곳입니다.

코딩도장 © 2014 · 문의 [email protected]
피드백 · 개인정보취급방침 · RSS

AltStyle によって変換されたページ (->オリジナル) /