728x90
+) 풀이 코드
https://github.com/jung0115/CodingTestPractice.git
다시 알고리즘 문제 풀기에서 감을 찾아보자!
1330번
#include <stdio.h>
int main(void){
int num1, num2;
scanf("%d %d", &num1, &num2);
if(num1 > num2)
printf(">");
else if(num1<num2)
printf("<");
else
printf("==");
return 0;
}
9498번
#include <stdio.h>
int main(void){
int score;
scanf("%d", &score);
if(score<=100 && score>=90)
printf("A");
else if(score<=89 && score>=80)
printf("B");
else if(score<=79 && score>=70)
printf("C");
else if(score<=69 && score>=60)
printf("D");
else
printf("F");
return 0;
}
2753번
#include <stdio.h>
int main(void){
int year;
scanf("%d", &year);
if(((year%4) == 0 && (year%100) != 0) || (year%400) == 0)
printf("1");
else
printf("0");
return 0;
}
14681번
#include <stdio.h>
int main(void){
int x, y;
scanf("%d", &x);
scanf("%d", &y);
if(x > 0 && y > 0)
printf("1");
else if(x < 0 && y > 0)
printf("2");
else if(x < 0 && y < 0)
printf("3");
else
printf("4");
return 0;
}
2884번
#include <stdio.h>
int main(void){
int H, M;
scanf("%d %d", &H, &M);
if(M < 45){
int sample;
sample = 45 - M;
M = 60 - sample;
if(H == 0)
H = 23;
else
H--;
}
else if(M == 45)
M = 0;
else
M -= 45;
printf("%d %d", H, M);
return 0;
}
728x90
'Programming > C' 카테고리의 다른 글
[백준] 단계별로 풀어보기 > 함수 (C언어) (0) | 2021.08.19 |
---|---|
[백준] 단계별로 풀어보기 > 1차원 배열 (C언어) (0) | 2021.03.25 |
[백준] 단계별로 풀어보기 > while문 (C언어) (0) | 2021.03.23 |
[백준] 단계별로 풀어보기 > for문 (C언어) (0) | 2021.03.21 |
[백준] 단계별로 풀어보기 > 입출력과 사칙연산 (C언어) (0) | 2021.03.13 |