20250526 baekjoon
This commit is contained in:
parent
cf3feab013
commit
5242432e12
18
code_study/Baekjoon/c/10809.c
Normal file
18
code_study/Baekjoon/c/10809.c
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
int main(){
|
||||||
|
int arr[26] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
|
||||||
|
int temp=0;
|
||||||
|
char s[101];
|
||||||
|
scanf("%s",s);
|
||||||
|
for(int i=0; s[i]!='\0'; i++){
|
||||||
|
temp = (int)(s[i]-'a');
|
||||||
|
if(arr[temp]==-1) arr[temp]=i;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i=0; i<26; i++){
|
||||||
|
printf("%d ",arr[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
19
code_study/Baekjoon/c/1152.c
Normal file
19
code_study/Baekjoon/c/1152.c
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
char s[1000001];
|
||||||
|
scanf("%[^\n]",s);
|
||||||
|
|
||||||
|
int n=0;
|
||||||
|
|
||||||
|
if(s[0]!=' ') n=1;
|
||||||
|
|
||||||
|
for(int i=0; s[i+1]!='\0'; i++){
|
||||||
|
if((s[i]==' ') && (s[i+1]!=' ')) n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%d",n);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
7
code_study/Baekjoon/c/11654.c
Normal file
7
code_study/Baekjoon/c/11654.c
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
int main(){
|
||||||
|
char c;
|
||||||
|
c = getchar();
|
||||||
|
printf("%d",c);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
9
code_study/Baekjoon/c/11718.c
Normal file
9
code_study/Baekjoon/c/11718.c
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
char s;
|
||||||
|
while(scanf("%c",&s)!= EOF){
|
||||||
|
printf("%c",s);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
12
code_study/Baekjoon/c/11720.c
Normal file
12
code_study/Baekjoon/c/11720.c
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
int main(){
|
||||||
|
int n, sum=0;
|
||||||
|
char s[101];
|
||||||
|
scanf("%d",&n);
|
||||||
|
scanf("%s",s);
|
||||||
|
for(int i=0; i<n; i++){
|
||||||
|
sum += (int)(s[i]-'0');
|
||||||
|
}
|
||||||
|
printf("%d",sum);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
23
code_study/Baekjoon/c/2675.c
Normal file
23
code_study/Baekjoon/c/2675.c
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
int t,n;
|
||||||
|
char s[20];
|
||||||
|
|
||||||
|
scanf("%d",&t);
|
||||||
|
|
||||||
|
for(int i=0; i<t; i++){
|
||||||
|
|
||||||
|
scanf("%d %s",&n,s);
|
||||||
|
|
||||||
|
for(int j=0; s[j]!='\0'; j++){
|
||||||
|
for(int k=0; k<n; k++){
|
||||||
|
printf("%c",s[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
9
code_study/Baekjoon/c/2743.c
Normal file
9
code_study/Baekjoon/c/2743.c
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
int main(){
|
||||||
|
char s[101];
|
||||||
|
int l=0;
|
||||||
|
gets(s);
|
||||||
|
for(l=0; s[l]!='\0'; l++);
|
||||||
|
printf("%d",l);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
9
code_study/Baekjoon/c/27866.c
Normal file
9
code_study/Baekjoon/c/27866.c
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
int main(){
|
||||||
|
char s[1001];
|
||||||
|
int i;
|
||||||
|
scanf("%s",s);
|
||||||
|
scanf("%d",&i);
|
||||||
|
printf("%c",s[i-1]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
25
code_study/Baekjoon/c/2908.c
Normal file
25
code_study/Baekjoon/c/2908.c
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
/*atoi*/
|
||||||
|
int main(){
|
||||||
|
char a[4], b[4];
|
||||||
|
char temp;
|
||||||
|
int x,y;
|
||||||
|
|
||||||
|
scanf("%s %s",a,b);
|
||||||
|
|
||||||
|
temp = a[0];
|
||||||
|
a[0] = a[2];
|
||||||
|
a[2] = temp;
|
||||||
|
|
||||||
|
temp = b[0];
|
||||||
|
b[0] = b[2];
|
||||||
|
b[2] = temp;
|
||||||
|
|
||||||
|
x = atoi(a);
|
||||||
|
y = atoi(b);
|
||||||
|
|
||||||
|
printf("%d",x>y ? x : y);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
18
code_study/Baekjoon/c/5622.c
Normal file
18
code_study/Baekjoon/c/5622.c
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
int dial[26] = {3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8,8,9,9,9,10,10,10,10};
|
||||||
|
char s[16];
|
||||||
|
int t=0;
|
||||||
|
|
||||||
|
scanf("%s",s);
|
||||||
|
|
||||||
|
for(int i=0; s[i]!='\0'; i++){
|
||||||
|
t+=dial[(int)(s[i]-'A')];
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%d",t);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
12
code_study/Baekjoon/c/9086.c
Normal file
12
code_study/Baekjoon/c/9086.c
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
int main(){
|
||||||
|
int n;
|
||||||
|
char s[1001];
|
||||||
|
scanf("%d",&n);
|
||||||
|
while(n--){
|
||||||
|
scanf("%s",s);
|
||||||
|
printf("%c%c\n",s[0], s[strlen(s)-1]);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user