온코더 레벨 3 홀수 짝수 판별
·
코테 문제 풀이/온코더 oncoder
class Solution: def solution(self, a): if a%2 == 0: res="EVEN" else : res="ODD" return res cs 출처 : www.oncoder.com/
온코더 레벨2 연산하기
·
코테 문제 풀이/온코더 oncoder
class Solution: def solution(self, a, b): return (a**3)+(b**2) cs 제곱 연산은 **를 사용한다 출처 : www.oncoder.com/
온코더 레벨1 문자열 리턴
·
코테 문제 풀이/온코더 oncoder
class Solution: def solution(self, str): self.a = str return self.a cs 문제가 리턴하라고 되어 있으므로 굳이 출력하지 않아도 된다... 출처 : www.oncoder.com/
2050. 알파벳을 숫자로 변환
·
코테 문제 풀이/SW Expert Academy
for i in input():print(ord(i) - 64, end=" ") cs 내장 함수 ord를 몰랐어서 6줄 정도 코드를 짰었는데 ord면 한 줄 코드를 작성할 수 있었다... ord는 문자의 아스키 코드 값을 돌려주는 함수이다. 파이썬은 항상 코드 짤 때 '분명 한 줄로 나올텐데...' 하면서 안 굴러가는 머리 쥐어짜내는 듯 ^__ㅠ 출처 : swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5QLGxKAzQDFAUq
199 : 구조체 - 형성평가5
·
코테 문제 풀이/정올
C #include struct info{ char name[20]; int a,b,c; int sum;}; main(){ int n,i,j; scanf("%d",&n); struct info p[n]; struct info tmp; for(i=0;i
198 : 구조체 - 형성평가4
·
코테 문제 풀이/정올
C #include typedef struct info{ int height; double weight;}I; main(){ I mom; I dad; I me; scanf("%d%lf",&mom.height,&mom.weight); scanf("%d%lf",&dad.height,&dad.weight); me.height=(mom.height+dad.height)/2+5; me.weight=(mom.weight+dad.weight)/2-4.5; printf("height : %dcm\n",me.height); printf("weight : %.1lfkg",me.weight);}Colored by Color Scriptercs 출처 : www.jungol.co.kr/bbs/board.php?bo_table=..
197 : 구조체 - 형성평가3
·
코테 문제 풀이/정올
C #include struct point{ int x; int y; int x2; int y2;}; main(){ struct rectangle{ struct point a; struct point b; }; struct rectangle r; scanf("%d%d%d%d",&r.a.x,&r.a.y,&r.a.x2,&r.a.y2); scanf("%d%d%d%d",&r.b.x,&r.b.y,&r.b.x2,&r.b.y2); int minx,maxx,miny,maxy; minx=r.a.x
196 : 구조체 - 형성평가2
·
코테 문제 풀이/정올
C #include #include typedef struct{ char name[50]; char num[50]; char add[50]; }I; main(){ I a[3]; int i,j; char b[50]="zz"; for(i=0;i