20250528 baekjoon C
This commit is contained in:
parent
8c5bf10e87
commit
af758ceb0f
30
code_study/Baekjoon/c/1316.c
Normal file
30
code_study/Baekjoon/c/1316.c
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
int cnt=0, flag, n;
|
||||||
|
scanf("%d",&n);
|
||||||
|
|
||||||
|
char s[101];
|
||||||
|
while(n--){
|
||||||
|
int chk[26] = {0,};
|
||||||
|
flag=0;
|
||||||
|
scanf("%s",s);
|
||||||
|
for(int i=0; s[i]!='\0'; i++){
|
||||||
|
if(chk[s[i]-'a']){
|
||||||
|
flag=1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(s[i]!=s[i+1]){
|
||||||
|
chk[s[i]-'a']=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!flag){
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%d",cnt);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
34
code_study/Baekjoon/c/25206.c
Normal file
34
code_study/Baekjoon/c/25206.c
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
char sub[51];
|
||||||
|
char rank[3];
|
||||||
|
float credit, sum_credit=0, sum_rank=0;
|
||||||
|
int n=20;
|
||||||
|
|
||||||
|
while(n--){
|
||||||
|
scanf("%s %f %s",sub,&credit,rank);
|
||||||
|
if(rank[0]!='P'){
|
||||||
|
if(rank[0]=='A'){
|
||||||
|
if(rank[1]=='+'){ sum_rank += credit*4.5; }
|
||||||
|
else{ sum_rank += credit*4.0; }
|
||||||
|
}
|
||||||
|
else if(rank[0]=='B'){
|
||||||
|
if(rank[1]=='+'){ sum_rank += credit*3.5; }
|
||||||
|
else{ sum_rank += credit*3.0; }
|
||||||
|
}
|
||||||
|
else if(rank[0]=='C'){
|
||||||
|
if(rank[1]=='+'){ sum_rank += credit*2.5; }
|
||||||
|
else{ sum_rank += credit*2.0; }
|
||||||
|
}
|
||||||
|
else if(rank[0]=='D'){
|
||||||
|
if(rank[1]=='+'){ sum_rank += credit*1.5; }
|
||||||
|
else{ sum_rank += credit*1.0; }
|
||||||
|
}
|
||||||
|
sum_credit+=credit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("%.6f",sum_rank/sum_credit);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
31
code_study/Baekjoon/c/2941.c
Normal file
31
code_study/Baekjoon/c/2941.c
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
char s[101];
|
||||||
|
scanf("%s",s);
|
||||||
|
|
||||||
|
int cnt=0, i=0;
|
||||||
|
while(s[i]!='\0'){
|
||||||
|
if(s[i]=='d' && s[i+1]=='z' && s[i+2]=='='){
|
||||||
|
i+=3;
|
||||||
|
}
|
||||||
|
else if(
|
||||||
|
s[i]=='c' && s[i+1]=='=' || s[i+1]=='-' ||
|
||||||
|
s[i]=='d' && s[i+1]=='-' ||
|
||||||
|
s[i]=='l' && s[i+1]=='j' ||
|
||||||
|
s[i]=='n' && s[i+1]=='j' ||
|
||||||
|
s[i]=='s' && s[i+1]=='=' ||
|
||||||
|
s[i]=='z' && s[i+1]=='='
|
||||||
|
){
|
||||||
|
i+=2;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%d",cnt);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user