본문 바로가기
728x90
반응형

C++6

[leetcode] Integer to Roman (c++) Problem Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, 2 is written as II in Roman numeral, just two one's added together. 12 is written as XII, which is simply X + II. The number 27 is written as XXVII, which is XX + V + II. Roman numerals are usually written largest to smallest from left to right.. 2021. 3. 21.
[Codility] Lesson15 - Caterpillar method: Abs Distinct Problem A non-empty array A consisting of N numbers is given. The array is sorted in non-decreasing order. The absolute distinct count of this array is the number of distinct absolute values among the elements of the array. For example, consider array A such that: A[0] = -5 A[1] = -3 A[2] = -1 A[3] = 0 A[4] = 3 A[5] = 6 The absolute distinct count of this array is 5, because there are 5 distinct.. 2021. 2. 15.
[Codility] Lesson12 - euclidean algorithm: Chocolates By Numbers Problem Two positive integers N and M are given. Integer N represents the number of chocolates arranged in a circle, numbered from 0 to N − 1. You start to eat the chocolates. After eating a chocolate you leave only a wrapper. You begin with eating chocolate number 0. Then you omit the next M − 1 chocolates or wrappers on the circle, and eat the following one. More precisely, if you ate chocolat.. 2021. 2. 8.
[C++] cin cout 입출력 시간 줄이기! printf, scanf에 비하면 c++의 입출력인 cin, cout은 시간은 확연히 느립니다. cin, cout이 stdio 버퍼와 싱크를 맞추기 때문인데, 이를 해제하면 입출력을 빠르게 할 수 있습니다. std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); std::cout.tie(nullptr); 2020. 9. 13.
728x90
반응형