baekjoon 20260122
This commit is contained in:
parent
c1c2d04eb9
commit
0a8c4f38aa
56
code_study/Baekjoon/c/2473.c
Normal file
56
code_study/Baekjoon/c/2473.c
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
typedef long long ll;
|
||||||
|
|
||||||
|
ll val[5000];
|
||||||
|
ll res[3];
|
||||||
|
ll minSumAbs = 5000000000000;
|
||||||
|
|
||||||
|
int compare(const void* a, const void* b) {
|
||||||
|
ll num1 = *(const ll*)a;
|
||||||
|
ll num2 = *(const ll*)b;
|
||||||
|
|
||||||
|
if (num1 > num2) return 1;
|
||||||
|
if (num1 < num2) return -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_res(ll a, ll b, ll c) {
|
||||||
|
res[0] = a;
|
||||||
|
res[1] = b;
|
||||||
|
res[2] = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int N;
|
||||||
|
scanf("%d",&N);
|
||||||
|
|
||||||
|
for(int i=0; i<N; i++) scanf("%lld",&val[i]);
|
||||||
|
qsort(val, N, sizeof(ll), compare);
|
||||||
|
|
||||||
|
for(int fix = 0; fix<N-2; fix++) {
|
||||||
|
ll a = val[fix];
|
||||||
|
|
||||||
|
int l = fix+1, r = N-1;
|
||||||
|
|
||||||
|
|
||||||
|
while(l < r) {
|
||||||
|
ll b = val[l], c = val[r];
|
||||||
|
ll current_sum = a + b + c;
|
||||||
|
ll current_abs = llabs(current_sum);
|
||||||
|
|
||||||
|
if(minSumAbs > current_abs) {
|
||||||
|
minSumAbs = current_abs;
|
||||||
|
set_res(a,b,c);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(current_sum < 0) l++;
|
||||||
|
else r--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i=0; i<3; i++) printf("%lld%s",res[i], i==2 ? "\n" : " ");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
1
code_study/Baekjoon/python/11282.py
Normal file
1
code_study/Baekjoon/python/11282.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
print(chr(int(input())-1 + 44032))
|
||||||
Loading…
x
Reference in New Issue
Block a user