아무거나적어~
-
[c++] size vs sizeof아무거나적어~ 2022. 12. 21. 07:28
1. sizeof sizeof() 함수는 메모리 공간을 차지하는 byte수를 return 합니다. the sizeof() operator does not give you the number of elements in an array, gives you the number of bytes a thing occupies in memory. sizeof() 함수로 포인터 변수의 크기를 구한다면 운영체제에 따른 byte 수가 return 32-bit operating system : 4bytes 64-bit operating system : 8bytes 배열의 이름은 배열의 시작주소를 의미합니다. sizeof(배열이름) 은 4bytes 혹은 8bytes가 return됩니다. an array type will d..
-
file을 이용해서 입출력 받고자 할 때아무거나적어~ 2022. 12. 14. 16:31
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 #include #define endl "\n" // don't use when you cover interactive problem #define all(v) (v).begin(), (v).end() using namespace std; typedef long long ll; typedef pair pi; typedef pair pl; int main() { #ifndef ONLINE_JUDGE freopen("../input.txt", "r", stdin); freopen("../output.txt", "w", stdout); #endif ios::sync_with_stdio(false);..
-
python3 Get minimum value with multiple criteria아무거나적어~ 2022. 9. 29. 15:12
1 2 3 4 5 6 7 8 9 10 11 12 from functools import cmp_to_key def left_low(l, r): if l[1] == r[1]: return l[0] - r[0] else: return l[1] - r[1] n = int(input()) d = [tuple(map(int, input().split())) for _ in range(n)] cri = min(d, key=cmp_to_key(left_low)) print(cri)cs min 은 빈 리스트가 들어오면 에러를 일으키기 때문에 default 를 사용하기도 합니다. 1 print(min([], default = 3))cs
-
-
선분교차아무거나적어~ 2022. 9. 26. 14:57
17387번: 선분 교차 2 첫째 줄에 L1의 양 끝 점 x1, y1, x2, y2가, 둘째 줄에 L2의 양 끝 점 x3, y3, x4, y4가 주어진다. www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 def ccw(u, v, w): a1, a2 = v[0] - u[0], v[1] - u[1] b1, b2 = w[0] - v[0], w[1] - v[1] return a1*b2 - a2*b1 x1, y1, x2, y2 = map(int, input().split()) x3, y3, x4, y4 = map(int, input().split()) d1 = (x1, y1) d2 = (x2, y2) d3 = (x3, y3) d4 = (..