일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 인공지능
- 파이썬
- Dehaze
- DCP
- 활성화 함수
- 자바 프로젝트
- 정규화
- 로스트아크
- 디자인 패턴
- 통계학
- 디자인패턴
- 딥러닝
- 자바
- 대학원 월급
- 영화 api
- 백준
- 인공지능 깃 버전관리
- API
- C# 프로젝트
- 경사하강법
- 대학원 급여
- 머신러닝
- 의료 ai 대학원 월급
- 자바 영화 api
- 코딩테스트
- python
- 파이썬 경사하강법
- 딥러닝 실험 깃 버전관리
- MLP
- pandas
Archives
- Today
- Total
대학원 일기
[백준 코딩 테스트] 2단계: if문 본문
두 수 비교하기(1330번)
#include<stdio.h>
int main() {
int A = 0;
int B = 0;
scanf("%d", &A);
scanf("%d", &B);
if (A == B) {
printf("==");
}
else if (A > B) {
printf(">");
}
else
printf("<");
return 0;
}
결과 화면
시험 성적(9498번)
#include<stdio.h>
int main() {
int score = 0;
scanf("%d", &score);
if (score >= 90) {
printf("A");
}
else if (score < 90 && score >= 80) {
printf("B");
}
else if (score < 80 && score >= 70) {
printf("C");
}
else if (score < 70 && score >= 60) {
printf("D");
}
else {
printf("F");
}
return 0;
}
결과 화면
윤년(2753번)
#include<stdio.h>
int main() {
int year = 0;
scanf("%d", &year);
if (year % 4 == 0) {
if (year % 100 != 0 || year % 400 == 0) {
printf("1");
}
else
printf("0");
}
else
printf("0");
return 0;
}
결과 화면
사분면 고르기(14861번)
#include<stdio.h>
int main() {
int x;
int y;
scanf("%d", &x);
scanf("%d", &y);
if (x > 0) {
if (y > 0) {
printf("1");
}
else
printf("4");
}
else {
if (y > 0) {
printf("2");
}
else
printf("3");
}
return 0;
}
결과 화면
알람 시계(2884번)
#include<stdio.h>
int main() {
int hour;
int min;
int x;
scanf("%d", &hour);
scanf("%d", &min);
if (hour == 0) {
if (min >= 45) {
printf("%d %d", hour, min - 45);
}
else {
hour = 23;
min = min + 60;
printf("%d %d", hour, min - 45);
}
}
else {
if (min >= 45) {
printf("%d %d", hour, min - 45);
}
else {
hour = hour - 1;
min = min + 60;
printf("%d %d", hour, min - 45);
}
}
return 0;
}
결과 화면
마치며
백준 코딩 테스트 단계별 문제 풀기 2단계(if문)를 풀어보았다. 아직까지는 문제되는 점이 보이지 않으면 쉽게 풀어낼 수 있었다. 다음 포스트에서는 3단계 for문을 풀어보겠다.
Comments