20250615 baekjoon C
This commit is contained in:
parent
1300f42151
commit
1a4082657b
21
code_study/Baekjoon/c/10101.c
Normal file
21
code_study/Baekjoon/c/10101.c
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int a, b, c, sum=0;
|
||||||
|
scanf("%d %d %d",&a,&b,&c);
|
||||||
|
sum = a + b + c;
|
||||||
|
if(sum!=180) {
|
||||||
|
printf("Error\n");
|
||||||
|
}
|
||||||
|
else if(a==b && a==c) {
|
||||||
|
printf("Equilateral\n");
|
||||||
|
}
|
||||||
|
else if(a==b || a==c || b==c) {
|
||||||
|
printf("Isosceles\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("Scalene\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
11
code_study/Baekjoon/c/1085.c
Normal file
11
code_study/Baekjoon/c/1085.c
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int x,y,w,h,i,j;
|
||||||
|
scanf("%d %d %d %d",&x,&y, &w, &h);
|
||||||
|
i = (w-x) < x ? (w-x) : x;
|
||||||
|
j = (h-y) < y ? (h-y) : y;
|
||||||
|
printf("%d\n", i<j ? i : j);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
19
code_study/Baekjoon/c/14215.c
Normal file
19
code_study/Baekjoon/c/14215.c
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int arr[3], max=0, sum=0;
|
||||||
|
for(int i=0; i<3; i++) {
|
||||||
|
scanf("%d",&arr[i]);
|
||||||
|
if(max<arr[i]) {
|
||||||
|
max = arr[i];
|
||||||
|
}
|
||||||
|
sum += arr[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
sum -= max;
|
||||||
|
|
||||||
|
if(sum>max) printf("%d\n",sum+max);
|
||||||
|
else printf("%d\n",2 * sum - 1);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
9
code_study/Baekjoon/c/15894.c
Normal file
9
code_study/Baekjoon/c/15894.c
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
long long n;
|
||||||
|
scanf("%lld",&n);
|
||||||
|
printf("%lld", 4*n);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
9
code_study/Baekjoon/c/27323.c
Normal file
9
code_study/Baekjoon/c/27323.c
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int a, b;
|
||||||
|
scanf("%d %d",&a, &b);
|
||||||
|
printf("%d",a*b);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
14
code_study/Baekjoon/c/3009.c
Normal file
14
code_study/Baekjoon/c/3009.c
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int x=0, y=0, a, b;
|
||||||
|
for(int i=0; i<3; i++) {
|
||||||
|
scanf("%d %d", &a, &b);
|
||||||
|
x ^=a;
|
||||||
|
y ^=b;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%d %d\n",x, y);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
37
code_study/Baekjoon/c/5073.c
Normal file
37
code_study/Baekjoon/c/5073.c
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int arr[3] = {1, 1, 1};
|
||||||
|
while(1) {
|
||||||
|
int max = 0, sum = 0, isTri;
|
||||||
|
for(int i=0; i<3; i++) {
|
||||||
|
scanf("%d",&arr[i]);
|
||||||
|
sum += arr[i];
|
||||||
|
if(max<arr[i]) {
|
||||||
|
max = arr[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(arr[0]==0 && arr[1]==0 && arr[2]==0) break;
|
||||||
|
|
||||||
|
sum -= max;
|
||||||
|
isTri = sum > max ? 1 : 0;
|
||||||
|
|
||||||
|
if(isTri) {
|
||||||
|
if(arr[0]==arr[1] && arr[1]==arr[2]) {
|
||||||
|
printf("Equilateral\n");
|
||||||
|
}
|
||||||
|
else if(arr[0]==arr[1] || arr[0]==arr[2] || arr[1]==arr[2]) {
|
||||||
|
printf("Isosceles\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("Scalene\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("Invalid\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
20
code_study/Baekjoon/c/9063.c
Normal file
20
code_study/Baekjoon/c/9063.c
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int n, x, y, min_x, min_y, max_x, max_y;
|
||||||
|
scanf("%d",&n);
|
||||||
|
scanf("%d %d",&min_x,&min_y);
|
||||||
|
max_x = min_x;
|
||||||
|
max_y = min_y;
|
||||||
|
for(int i=0; i<n-1; i++) {
|
||||||
|
scanf("%d %d",&x, &y);
|
||||||
|
min_x = min_x<x ? min_x : x;
|
||||||
|
max_x = max_x>x ? max_x : x;
|
||||||
|
min_y = min_y<y ? min_y : y;
|
||||||
|
max_y = max_y>y ? max_y : y;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%d", (max_x-min_x)*(max_y-min_y));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user