티스토리 뷰
주어진 코드
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
int solution(int taekwondo, int running, int shooting[], int shooting_len) {
int answer = 0;
if (taekwondo >= 25)
answer += 빈칸 ;
else
answer += taekwondo * 8;
answer += 250 + (60 - running) * 5;
int count = 0;
for (int i = 0; i < shooting_len; i++) {
answer += shooting[i];
if (shooting[i] == 10)
count++;
}
if (count >= 7)
answer += 빈칸 ;
return answer;
}
int main() {
int taekwondo = 27;
int running = 63;
int shooting[] = { 9, 10, 8, 10, 10, 10, 7, 10, 10, 10 };
int shooting_len = 10;
int ret = solution(taekwondo, running, shooting, shooting_len);
printf("solution 함수의 반환 값은 %d 입니다.\n", ret);
}
완성 코드
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
int solution(int taekwondo, int running, int shooting[], int shooting_len) {
int answer = 0;
if (taekwondo >= 25)
answer += 250;
else
answer += taekwondo * 8;
answer += 250 + (60 - running) * 5;
int count = 0;
for (int i = 0; i < shooting_len; i++) {
answer += shooting[i];
if (shooting[i] == 10)
count++;
}
if (count >= 7)
answer += 100;
return answer;
}
int main() {
int taekwondo = 27;
int running = 63;
int shooting[] = { 9, 10, 8, 10, 10, 10, 7, 10, 10, 10 };
int shooting_len = 10;
int ret = solution(taekwondo, running, shooting, shooting_len);
printf("solution 함수의 반환 값은 %d 입니다.\n", ret);
}
예시
taekwondo | running | shooting | shooting_len | return |
27 | 63 | [9, 10, 8, 10, 10, 10, 7, 10, 10, 10] | 10 | 679 |
goorm
구름은 클라우드 기술을 이용하여 누구나 코딩을 배우고, 실력을 평가하고, 소프트웨어를 개발할 수 있는 클라우드 소프트웨어 생태계입니다.
www.goorm.io
'[코테] > [GroomEdu]' 카테고리의 다른 글
[COS PRO 2급] 5차 5번_n일장이 함께 열리는 날은 언제인가요? (C/C++) (0) | 2021.05.25 |
---|---|
[COS PRO 2급] 5차 6번_이제 수학 시험에 모든걸 건다 평균 70을 위하여 (C/C++) (0) | 2021.05.25 |
[COS PRO 2급] 5차 3번_벌금을 세금내듯 내면 안되요, 벌금 구하기! (C/C++) (0) | 2021.05.24 |
[COS PRO 2급] 5차 1번_사다리 게임의 승자를 구해주세요! (C/C++) (0) | 2021.05.23 |
[COS PRO 2급] 5차 2번_공강시간 구하기 (C/C++) (0) | 2021.05.23 |
댓글
공지사항
최근에 올라온 글
TAG
- C
- cospro기출문제
- lv1
- cospro기출
- 프로그래머스
- C++
- groomedu
- 1급
- Cos Pro
- c언어 기출문제
- 코딩테스트
- CosPro
- COSPRO 2급
- lv2
- c언어
- YBM
- 연습문제
- 배열
- YBM기출
- 코스프로
- 기출문제
- 자바
- 구름 기출문제
- 구름에듀 기출문제
- 구름에듀
- programmers
- 알고리즘
- 배열활용문제
- Java
- groom
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함