목록전체 글 (113)
W 개발 일지
class Solution: def solution(self, arr): cnt=0 for i in range(len(arr)): if arr[i]%2==0: cnt +=1 return cnt cs 출처 : www.oncoder.com/
class Solution: def solution(self, a): if a%2 == 0: res="EVEN" else : res="ODD" return res cs 출처 : www.oncoder.com/
class Solution: def solution(self, a, b): return (a**3)+(b**2) cs 제곱 연산은 **를 사용한다 출처 : www.oncoder.com/
class Solution: def solution(self, str): self.a = str return self.a cs 문제가 리턴하라고 되어 있으므로 굳이 출력하지 않아도 된다... 출처 : www.oncoder.com/
for i in input():print(ord(i) - 64, end=" ") cs 내장 함수 ord를 몰랐어서 6줄 정도 코드를 짰었는데 ord면 한 줄 코드를 작성할 수 있었다... ord는 문자의 아스키 코드 값을 돌려주는 함수이다. 파이썬은 항상 코드 짤 때 '분명 한 줄로 나올텐데...' 하면서 안 굴러가는 머리 쥐어짜내는 듯 ^__ㅠ 출처 : swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5QLGxKAzQDFAUq
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
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=..
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