목록개인 공부/CodeUp 문제 풀이 (102)
hy30nq's blog
https://codeup.kr/problem.php?id=1286 최댓값, 최솟값 $5$개의 정수가 한 줄에 하나씩 입력된다.(범위 : $-1,000,000$ ~ $1,000,000$) codeup.kr 답 #include int main() { int max = -1000000; int min = 1000000; int n, i; for(i = 0; i max) max = n; if(n < min) min = n; } printf("%d\n%d", max, min); return 0; }
https://codeup.kr/problem.php?id=1103 폴더명 출력 printf()함수를 공부하는 진영이는 다음 폴더명을 출력해보기로 했다. "c:\test" printf함수에는 특별한 제어문자가 몇개 있다. 큰따옴표(")를 출력하기 위해선 \" 를 사용해야 하고, \를 출력하기 위해 codeup.kr 답 #include int main() { printf("\"c:\\test\""); }
https://codeup.kr/problem.php?id=1102 Hello, World! (줄 바꿈 버전) Hello,와 \n사이에 공백을 넣지 않도록 합니다.(표현 오류 사유) codeup.kr 답 #include int main() { printf("Hello,\nWorld!"); }
https://codeup.kr/problem.php?id=1101 Hello, World! 이 사이트의 모든 문제는 출력 예시와 똑같은 형태로 출력해야 합니다. 이 문제는 Hello, World! 를 출력하면 되는 문제입니다.(아래 힌트를 참고하세요) codeup.kr 답 #include int main() { printf("Hello, World!"); }
https://codeup.kr/problem.php?id=1099 [기초-2차원배열] 성실한 개미 C언어기초100제v1.2 : @컴퓨터과학사랑, 전국 정보(컴퓨터)교사 커뮤니티/연구회 - 학교 정보(컴퓨터)선생님들과 함께 수업/방과후학습/동아리활동 등을 통해 재미있게 배워보세요. - 모든 내용 codeup.kr 답 #include int map[12][12]; void back(int r, int c) { if(map[r][c] == 2) { map[r][c] = 9; return ; } map[r][c] = 9; if(map[r][c+1] != 1) back(r, c+1); else if(map[r+1][c] != 1) back(r+1, c); } int main() { int i, j; for(i ..
https://codeup.kr/problem.php?id=1098 [기초-2차원배열] 설탕과자 뽑기 C언어기초100제v1.2 : @컴퓨터과학사랑, 전국 정보(컴퓨터)교사 커뮤니티/연구회 - 학교 정보(컴퓨터)선생님들과 함께 수업/방과후학습/동아리활동 등을 통해 재미있게 배워보세요. - 모든 내용 codeup.kr 답 #include int h, w, n; int l, d, x, y; int i, j; int map[2000][2000]; main() { scanf("%d%d%d", &h, &w, &n); for(i=0; i < n; i++) { scanf("%d%d%d%d", &l, &d, &x, &y); if(d == 0) { for(j=y; j
https://codeup.kr/problem.php?id=1097 [기초-2차원배열] 바둑알 십자 뒤집기(설명) C언어기초100제v1.2 : @컴퓨터과학사랑, 전국 정보(컴퓨터)교사 커뮤니티/연구회 - 학교 정보(컴퓨터)선생님들과 함께 수업/방과후학습/동아리활동 등을 통해 재미있게 배워보세요. - 모든 내용 codeup.kr 답 #include int n, i, j, k, a, b; int map[20][20]; int main() { for(i=1; i
https://codeup.kr/problem.php?id=1096 [기초-2차원배열] 바둑판에 흰 돌 놓기(설명) C언어기초100제v1.2 : @컴퓨터과학사랑, 전국 정보(컴퓨터)교사 커뮤니티/연구회 - 학교 정보(컴퓨터)선생님들과 함께 수업/방과후학습/동아리활동 등을 통해 재미있게 배워보세요. - 모든 내용 codeup.kr 답 #include int main() { int num, x, y, arr[19][19] = { 0 }; scanf(" %d", &num); for(int i=0; i