스키마에듀 _ 0211 수업준비
              
          2023. 2. 9. 23:08ㆍ스키마에듀 c언어 수업
728x90
    
    
  https://www.acmicpc.net/problem/2743
2743번: 단어 길이 재기
알파벳으로만 이루어진 단어를 입력받아, 그 길이를 출력하는 프로그램을 작성하시오.
www.acmicpc.net

https://www.acmicpc.net/problem/1152
1152번: 단어의 개수
첫 줄에 영어 대소문자와 공백으로 이루어진 문자열이 주어진다. 이 문자열의 길이는 1,000,000을 넘지 않는다. 단어는 공백 한 개로 구분되며, 공백이 연속해서 나오는 경우는 없다. 또한 문자열
www.acmicpc.net

https://www.acmicpc.net/problem/13235
13235번: 팰린드롬
팰린드롬은 앞에서부터 읽을 때와 뒤에서부터 읽을 때가 똑같은 단어를 의미한다. 예를 들어, eve, eevee는 팰린드롬이고, eeve는 팰린드롬이 아니다. 단어가 주어졌을 때, 팰린드롬인지 아닌지 판
www.acmicpc.net
//단어 길이 재기
#include <stdio.h>
int main(void){
	char input[100]={};
	scanf("%s",input);
	
	int i=0, cnt=0;
	
	while(input[i]!='\0'){
		cnt++;
		i++;
	}
	
	printf("%d", cnt);
}
//1152 단어의 개수
#include <stdio.h>
#include <string.h>
int main(void){
	char input[1000000]={};
	gets(input);
	
	int i=0, cnt=1;
	
	if(strlen(input)==1 && input[i]==' '){
		printf("%d",0);
		return 0;
	}
	
	for(i=1;i<strlen(input)-1;i++){
		if(input[i]==' '){
				cnt++;
		}
	}
	
	printf("%d", cnt);
	return 0;
}
//13235 팰린드롬
#include <stdio.h>
#include <string.h>
int main(void){
	char palindrome[10000];
	int n=0, i=0;
	
	scanf("%s", palindrome);
	
	n = strlen(palindrome);
	
	
	for(i=0;i<int(n/2);i++){
		if(palindrome[i]!= palindrome[n-1-i]){
			printf("false");
			return 0;
		}
	}
	
	printf("true");
	return 0;
}'스키마에듀 c언어 수업' 카테고리의 다른 글
| 0311 스키마에듀 백준 3문제 (브론즈 1 + 실버 2) (0) | 2023.03.08 | 
|---|---|
| 스키마에듀 0304 수업 백준 3문제 (0) | 2023.03.03 | 
| [스키마에듀 수업자료] 동적할당 관련 자료 + 과제 (1) | 2023.02.23 | 
| 스키마에듀 02/25 수업 백준 3문제 (0) | 2023.02.23 | 
| 스키마에듀 수업 _ 0218 part 3 파일 입출력 연습문제 (0) | 2023.02.17 |