실수모음
-
[python] round 는 당신이 알고 있는 반올림이 아닙니다실수모음 2023. 1. 14. 04:35
https://stackoverflow.com/questions/33019698/how-to-properly-round-up-half-float-numbers ", round(n)) This code prints: 0.5 => 0 1.5 => 2 2.5 => 2 3.5 => 4 ..." data-og-host="stackoverflow.com" data-og-source-url="https://stackoverflow.com/questions/33019698/how-to-properly-round-up-half-float-numbers" data-og-url="https://stackoverflow.com/questions/33019698/how-to-properly-round-up-half-float-..
-
[c++] dp 캐싱할때 절대 나오지 않는걸로 초기화해야함실수모음 2022. 12. 23. 14:44
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 #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; ll m; l..
-
[c++] 실수 & 코너케이스(수정 24.03.26.)실수모음 2022. 12. 22. 16:46
맞왜틀인경우 일단 문제를 다시 읽어보자 코너 케이스가 될 수 있는 경우 입력 데이터의 최대, 최소 ex) https://cses.fi/problemset/task/1194/ n, m 이 모두 1 ex) 0 이 들어갈 때 ex) 그래프에서 루트만 주어지는 경우 뭔가가 없어도 되는 경우 ex) https://cses.fi/problemset/task/1194/ 몬스터가 없는 경우 trivial case(코드 돌릴필요 없이 바로 끝나는 경우) ex) https://cses.fi/problemset/task/1194/ A가 처음부터 가장자리에 있는 경우 ex) https://cses.fi/problemset/task/1746/ 빈칸을 채우기 전에 조건에 위배되는 경우 이동이 주어진 격자점 밖에서 이루어질 수 있..
-
-
[c++] unsigned int + int실수모음 2022. 12. 21. 12:40
c++ implicit type casting 어지간하면 unsigned 쓰지 말자 unsigned int 가 음수가 되지 않게하는 이상 계산값은 잘 나오긴 함 부호가 없는게 있는걸로 바뀜 사용하는 메모리 작은 자료형이 큰 자료형으로 바뀜(데이터 손실 막기 위함) int -3 즉, 11111111111111111111111111111101(2) 이 unsigned int 가 되어 4294967293가 됨 요기에 1이 더해져서 4294967294 가 나오는거 int -1 즉, 11111111111111111111111111111111(2) 이 unsigned int 가 되어 4294967295가 됨 요기에 3이 더해져서 2가 나오는거 11111111111111111111111111111111 + 1 = 0..