본문 바로가기

전체 글245

[프로그래머스] 수열과 구간 쿼리 1(c++) https://school.programmers.co.kr/learn/courses/30/lessons/181883 답 #include #include using namespace std; vector solution(vector arr, vector queries) { for(int i=0;i 2023. 12. 25.
[프로그래머스] 대소문자 바꿔서 출력하기(c언어) https://school.programmers.co.kr/learn/courses/30/lessons/181949 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 답 #include #define LEN_INPUT 30 int main(void) { char s1[LEN_INPUT]; scanf("%s", s1); for(int i=0;i='A'&&s1[i]='a'&&s1[i] 2023. 12. 25.
[프로그래머스] 빈 배열에 추가, 삭제하기(c++) https://school.programmers.co.kr/learn/courses/30/lessons/181860 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 답 #include #include using namespace std; vector solution(vector arr, vector flag) { vector answer; for(int i=0;i 2023. 12. 25.
[프로그래머스] l로 만들기(c++) https://school.programmers.co.kr/learn/courses/30/lessons/181834 답 #include #include using namespace std; string solution(string myString) { string answer = ""; for(int i=0;i 2023. 12. 25.
[프로그래머스] 특수문자 출력하기(c언어) https://school.programmers.co.kr/learn/courses/30/lessons/181948 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 답 #include int main(void) { printf("!@#$%%^&*(\\'\"?:;"); return 0; } c언어에선 출력을 할때 출력하고싶은 글자 출력방법 % %% \ \\ " \" 이렇게 한다. 끝 2023. 12. 25.
[프로그래머스] 덧셈식 출력하기(c언어) https://school.programmers.co.kr/learn/courses/30/lessons/181947?language=c 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 답 #include int main(void) { int a; int b; scanf("%d %d", &a, &b); printf("%d + %d = %d",a,b, a + b); return 0; } 정수변수 a,b를 만들어준다. scanf를 사용해서 a,b를 입력받아준다. (정수기 떄문에 %d를 사용했고 입력받을떄 &를 변수앞에 붙여주었다.) ​ 출력형식대로 출력했다. 끝 2023. 12. 24.