별의 공부 블로그 🧑🏻‍💻

🗒️ 2017/11/08 (92)

728x90
  1. 2017.11.08 [BOJ11050][C++] 이항 계수 1

    문제자연수 N과 정수 K가 주어졌을 때 이항 계수를 구하는 프로그램을 작성하시오. 입력첫째 줄에 N과 K가 주어진다. (1 ≤ N ≤ 10, 0 ≤ K ≤ N) 출력를 출력한다. 예제 입력 5 2 예제 출력 10 힌트 출처· 문제를 만든 사람: baekjoon 코드 123456789101112131415161718192021222324#include using namespace std; long long bicoeff(int n, int r){ if (n == r || r == 0) { return 1; } else { return bicoeff(n - 1, r - 1) + bicoeff(n - 1, r); }} int main(){ int N, K; cin >> N >> K; cout

  2. 2017.11.08 [BOJ1676][C++] 팩토리얼 0의 개수

    문제N!에서 뒤에서부터 처음 0이 아닌 숫자가 나올 때까지 0의 개수를 구하는 프로그램을 작성하시오. 입력첫째 줄에 N이 주어진다. (0 ≤ N ≤ 500) 출력첫째 줄에 구한 0의 개수를 출력한다. 예제 입력 10 예제 출력 2 힌트 출처· 문제를 만든 사람: author6 코드 12345678910111213141516#include using namespace std; int main(){ int cnt = 0, n; cin >> n; for (int i = 1; i

  3. 2017.11.08 [BOJ11004][C++] K번째 수 : 오름차순 정렬

    문제수 N개 이 주어진다. A를 오름차순 정렬했을 때, 앞에서부터 K번째 있는 수를 구하는 프로그램을 작성하시오. 입력첫째 줄에 N(1 ≤ N ≤ 5,000,000)과 K (1 ≤ K ≤ N)이 주어진다. 둘째에는 이 주어진다. () 출력A를 정렬했을 때, 앞에서부터 K번째 있는 수를 출력한다. 예제 입력 5 2 4 1 2 3 5 예제 출력 2 힌트 출처· 문제를 만든 사람: baekjoon 알고리즘 분류· 정렬 코드 123456789101112#include #include using namespace std;int n, k, N[5000000];int main(){ scanf("%d %d", &n, &k); for (int i = 0; i

  4. 2017.11.08 [BOJ10872][C++] 팩토리얼

    문제0보다 크거나 같은 정수 N이 주어진다. 이 때, N!을 출력하는 프로그램을 작성하시오. 입력첫째 줄에 정수 N(0 ≤ N ≤ 12)가 주어진다. 출력첫째 줄에 N!을 출력한다. 예제 입력 10 예제 출력 3628800 힌트 출처· 문제를 만든 사람: baekjoon 알고리즘 분류· 구현 코드 1234567891011121314151617#include using namespace std; int main(){ int n, sum = 1; cin >> n; for (int i = 1; i

  5. 2017.11.08 정렬 알고리즘의 시간 복잡도 비교

    Array Sorting Algorithms AlgorithmTime ComplexitySpace ComplexityBestAverageWorstWorstQuicksortΩ(n log(n))Θ(n log(n))O(n^2)O(log(n))MergesortΩ(n log(n))Θ(n log(n))O(n log(n))O(n)TimsortΩ(n)Θ(n log(n))O(n log(n))O(n)HeapsortΩ(n log(n))Θ(n log(n))O(n log(n))O(1)Bubble SortΩ(n)Θ(n^2)O(n^2)O(1)Insertion SortΩ(n)Θ(n^2)O(n^2)O(1)Selection SortΩ(n^2)Θ(n^2)O(n^2)O(1)Tree SortΩ(n log(n))Θ(n log(n))O(n^2)..

  6. 2017.11.08 [BOJ2750][C++] 수 정렬하기 : 오름차순 정렬

    문제N개의 수가 주어졌을 때, 이를 오름차순으로 정렬하는 프로그램을 작성하시오. 입력첫째 줄에 수의 개수 N(1 n; for (int i = 0; i > ary[i]; } for (int i = 0; i

  7. 2017.11.08 데이터 형식 범위

    데이터 형식 범위Visual Studio 2015 게시 날짜: 2016년 6월Visual Studio 2017 에 대한 최신 설명서는 Visual Studio 2017 설명서를 참조하세요.Visual C++ 32비트 및 64비트 컴파일러는 이 문서의 뒷부분의 표에 나온 형식을 인식합니다.int (unsigned``int)__int8 (unsigned``__int8)__int16 (unsigned``__int16)__int32 (unsigned``__int32)__int64 (unsigned``__int64)short (unsigned``short)long (unsigned``long)long long (unsigned``long``long)이름이 두 개의 밑줄(__)로 시작하는 경우 데이터 형식은 비표준..

  8. 2017.11.08 [BOJ2748][C++] 피보나치 수 2

    문제피보나치 수는 0과 1로 시작한다. 0번째 피보나치 수는 0이고, 1번째 피보나치 수는 1이다. 그 다음 2번째 부터는 바로 앞 두 피보나치 수의 합이 된다. 이를 식으로 써보면 Fn = Fn-1 + Fn-2 (n>=2)가 된다. n=17일때 까지 피보나치 수를 써보면 다음과 같다. 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597 n이 주어졌을 때, n번째 피보나치 수를 구하는 프로그램을 작성하시오. 입력첫째 줄에 n이 주어진다. n은 90보다 작거나 같은 자연수이다. 출력첫째 줄에 n번째 피보나치 수를 출력한다. 예제 입력 10 예제 출력 55 힌트 코드 1234567891011121314151617181920212223..

  9. 2017.11.08 [BOJ2747][C++] 피보나치 수

    문제피보나치 수는 0과 1로 시작한다. 0번째 피보나치 수는 0이고, 1번째 피보나치 수는 1이다. 그 다음 2번째 부터는 바로 앞 두 피보나치 수의 합이 된다. 이를 식으로 써보면 Fn = Fn-1 + Fn-2 (n>=2)가 된다. n=17일때 까지 피보나치 수를 써보면 다음과 같다. 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597 n이 주어졌을 때, n번째 피보나치 수를 구하는 프로그램을 작성하시오. 입력첫째 줄에 n이 주어진다. n은 45보다 작거나 같은 자연수이다. 출력첫째 줄에 n번째 피보나치 수를 출력한다. 예제 입력 10 예제 출력 55 힌트 코드 12345678910111213141516171819202122#i..

  10. 2017.11.08 [BOJ11022][C++] A+B - 8

    문제두 수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. 입력첫째 줄에 테스트 케이스의 개수 T가 주어진다. 각 테스트 케이스는 한 줄로 이루어져 있으며, 각 줄에 A와 B가 주어진다. (0 < A,B < 10) 출력각 테스트 케이스마다 "Case #x: A + B = C" 형식으로 출력한다. x는 테스트 케이스 번호이고 1부터 시작하며, C는 A+B이다. 예제 입력 5 1 1 2 3 3 4 9 8 5 2 예제 출력 Case #1: 1 + 1 = 2 Case #2: 2 + 3 = 5 Case #3: 3 + 4 = 7 Case #4: 9 + 8 = 17 Case #5: 5 + 2 = 7 힌트 출처· 문제를 만든 사람: baekjoon 알고리즘 분류· 사칙연산 코드 12345678910..

  11. 2017.11.08 [BOJ11021][C++] A+B - 7

    문제두 수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. 입력첫째 줄에 테스트 케이스의 개수 T가 주어진다. 각 테스트 케이스는 한 줄로 이루어져 있으며, 각 줄에 A와 B가 주어진다. A와 B는 콤마(,)로 구분되어 있다. (0 < A,B < 10) 출력각 테스트 케이스마다 "Case #x: "를 출력한 다음, A+B를 출력한다. 테스트 케이스 번호는 1부터 시작한다. 예제 입력 5 1,1 2,3 3,4 9,8 5,2 예제 출력 Case #1: 2 Case #2: 5 Case #3: 7 Case #4: 17 Case #5: 7 힌트 출처· 문제를 만든 사람: baekjoon 알고리즘 분류· 사칙연산 코드 1234567891011121314151617#include using nam..

  12. 2017.11.08 [BOJ10953][C++] A+B - 6

    문제두 수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. 입력첫째 줄에 테스트 케이스의 개수 T가 주어진다. 각 테스트 케이스는 한 줄로 이루어져 있으며, 각 줄에 A와 B가 주어진다. A와 B는 콤마(,)로 구분되어 있다. (0 > T; for (int i = 0; i > num; cout

  13. 2017.11.08 [BOJ10952][C++] A+B - 5

    문제두 수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. 입력입력은 여러 개의 테스트 케이스로 이루어져 있다. 각 테스트 케이스는 한 줄로 이루어져 있으며, 각 줄에 A와 B가 주어진다. (0 > a >> b) { if ((a == 0) && (b == 0..

  14. 2017.11.08 [BOJ10951][C++] A+B - 3

    문제두 수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. 입력첫째 줄에 테스트 케이스의 개수 T가 주어진다. 각 테스트 케이스는 한 줄로 이루어져 있으며, 각 줄에 A와 B가 주어진다. (0 > T; for (int i = 0; i > a >> b; cout

  15. 2017.11.08 [BOJ10951][C++] A+B - 4

    문제두 수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. 입력입력은 여러 개의 테스트 케이스로 이루어져 있다. 각 테스트 케이스는 한 줄로 이루어져 있으며, 각 줄에 A와 B가 주어진다. (0 > a >> b) cout b)을 사용해서 연산을 수행해야 한다.- 처음에는 아래와 같이 코드를 작성하여 제출하였으나 출력초과가 떠버..

  16. 2017.11.08 [header][C library] cwctype (wctype.h)

    *[header][C library] cwctype (wctype.h) (wctype.h)Wide character typeThis header declares a set of functions to classify and transform individual wide characters. For more info on how the standard ASCII character set is classified using the "C" locale, see . FunctionsCharacter classification functionsThey check whether the character passed as parameter belongs to a certain category: iswalnumChec..

  17. 2017.11.08 [header][C library] cwchar (wchar.h)

    *[header][C library] cwchar (wchar.h) (wchar.h)Wide charactersThis header file defines several functions to work with C wide strings. FunctionsInput/Output: (mostly wide versions of functions) fgetwcGet wide character from stream (function )fgetwsGet wide string from stream (function )fputwcWrite wide character to stream (function )fputwsWrite wide string to stream (function )fwideStream orienta..

  18. 2017.11.08 [header][C library] cuchar (uchar.h) (C++11)

    *[header][C library] cuchar (uchar.h) (C++11) (uchar.h)Unicode charactersThis header provides support for 16-bit and 32-bit characters, suitable to be encoded using UTF-16 and UTF-32. TypesIn C, this header defines two macros: char16_t and char32_t, which map to unsigned integral types of the appropriate size (the same as uint_least16_t and uint_least32_t, respectively). In C++, char16_t and cha..

  19. 2017.11.08 [header][C library] ctime (time.h)

    *[header][C library] ctime (time.h) (time.h)C Time LibraryThis header file contains definitions of functions to get and manipulate date and time information. FunctionsTime manipulationclockClock program (function )difftimeReturn difference between two times (function )mktimeConvert tm structure to time_t (function )timeGet current time (function ) ConversionasctimeConvert tm structure to string ..

  20. 2017.11.08 [header][C library] ctgmath (tgmath.h) (C++11)

    *[header][C library] ctgmath (tgmath.h) (C++11) (tgmath.h)Type-generic mathCC++This header defines macro functions that correspond to the functions in , but which can take other non-floating point types as arguments: Every function in that takes at least one double as argument (except modf) is defined in as a macro with the same semantics but taking generic parameters instead: Each of the argume..

  21. 2017.11.08 [header][C library] cstring (string.h)

    *[header][C library] cstring (string.h) (string.h)C StringsThis header file defines several functions to manipulate C strings and arrays. FunctionsCopying: memcpyCopy block of memory (function )memmoveMove block of memory (function )strcpyCopy string (function )strncpyCopy characters from string (function ) Concatenation: strcatConcatenate strings (function )strncatAppend characters from string ..

  22. 2017.11.08 [header][C library] cstdlib (stdlib.h)

    *[header][C library] cstdlib (stdlib.h) (stdlib.h)C Standard General Utilities LibraryThis header defines several general purpose functions, including dynamic memory management, random number generation, communication with the environment, integer arithmetics, searching, sorting and converting. FunctionsString conversionatofConvert string to double (function )atoiConvert string to integer (funct..

  23. 2017.11.08 [header][C library] cstdio (stdio.h)

    *[header][C library] cstdio (stdio.h) (stdio.h)C library to perform Input/Output operationsInput and Output operations can also be performed in C++ using the C Standard Input and Output Library (cstdio, known as stdio.h in the C language). This library uses what are called streams to operate with physical devices such as keyboards, printers, terminals or with any other type of files supported by..

  24. 2017.11.08 [header][C library] cstdint (stdint.h) (C++11)

    *[header][C library] cstdint (stdint.h) (C++11) (stdint.h)Integer typesThis header defines a set of integral type aliases with specific width requirements, along with macros specifying their limits and macro functions to create values of these types. TypesThe following are typedefs of fundamental integral types or extended integral types. signed typeunsigned typedescriptionintmax_tuintmax_tInteg..

  25. 2017.11.08 [header][C library] cstddef (stddef.h)

    *[header][C library] cstddef (stddef.h) (stddef.h)C Standard definitionsThis header defines several types implicitly generated or used by certain language expressions. Typesptrdiff_tResult of pointer subtraction (type )size_tUnsigned integral type (type )max_align_t Type with widest scalar alignment (type )nullptr_t Null pointer type (C++) (type ) In C, this header also includes the declaration ..

  26. 2017.11.08 [header][C library] cstdbool (stdbool.h) (C++11)

    *[header][C library] cstdbool (stdbool.h) (C++11) (stdbool.h)Boolean typeThe purpose in C of this header is to add a bool type and the true and false values as macro definitions. In C++, which supports those directly, the header simply contains a macro that can be used to check if the type is supported: Macro constants Macrodescriptiondefined as__bool_true_false_are_definedSpecifies whether bool..

  27. 2017.11.08 [header][C library] cstdarg (stdarg.h)

    *[header][C library] cstdarg (stdarg.h) (stdarg.h)Variable arguments handlingThis header defines macros to access the individual arguments of a list of unnamed arguments whose number and types are not known to the called function. A function may accept a varying number of additional arguments without corresponding parameter declarations by including a comma and three dots (,...) after its regula..

  28. 2017.11.08 [header][C library] csignal (signal.h)

    *[header][C library] csignal (signal.h) (signal.h)C library to handle signalsSome running environments use signals to inform running processes of certain events. These events may be related to errors performed by the program code, like a wrong arithmetical operation or to exceptional situations, such as a request to interrupt the program. Signals generally represent situations where the program ..

  29. 2017.11.08 [header][C library] csetjmp (setjmp.h)

    *[header][C library] csetjmp (setjmp.h) (setjmp.h)Non local jumpsThe tools provided through this header file allow the programmer to bypass the normal function call and return discipline, by providing the means to perform jumps preserving the calling environment. The header provides, a function, a macro with functional form and a specific type: FunctionslongjmpLong jump (function ) Macro functio..

  30. 2017.11.08 [header][C library] cmath (math.h)

    *[header][C library] cmath (math.h) (math.h)C numerics libraryHeader declares a set of functions to compute common mathematical operations and transformations: Functions Trigonometric functionscosCompute cosine (function )sinCompute sine (function )tanCompute tangent (function )acosCompute arc cosine (function )asinCompute arc sine (function )atanCompute arc tangent (function )atan2Compute arc t..

728x90


📖 Contents 📖