일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- flask
- 2015 봄학기 알고리즘
- 백준
- 피보나치 수
- til
- Numpy
- baekjun
- cpp
- matrixElementsSum
- Counting cells in a blob
- 파이썬머신러닝완벽가이드
- codesingal
- All Longest Strings
- codesignal
- Python
- Daily Commit
- Sequential Search
- C++
- recursion
- centuryFromYear
- shapeArea
- 파이썬 포렌식
- 수 정렬하기
- markdown
- 10953
- adjacentElementsProduct
- 2750
- collections.deque
- data_structure
- almostIncreasingSequence
- Today
- Total
목록Doing/C&C++ 34
Introfor
The way most people learn to multiply large numbers looks something like this: 86 x 57 ------ 602 + 4300 ------ 4902If you know your multiplication facts, this "long multiplication" is quick and relatively simple. However, there are many other ways to multiply. One of these methods is often called the Russian peasant algorithm. You don't need multiplication facts to use the Russian peasant algor..
123456789101112131415#include int main() { int num = 0; int fibo = 0, fibo1 = 0, fibo2 = 1; scanf("%d",&num); for(; num>0; num--){ printf("%d ",fibo); fibo = fibo2; fibo2 += fibo1; fibo1 = fibo; }}Colored by Color Scriptercs 12345678910111213141516171819202122232425#include int f(int n); int main(){ int num = 0; scanf("%d ",&num); for(int i = 0 ; i
1234567891011121314151617181920#include void hanoi(int n, int from, int by, int to){ if (n == 1) printf("\nMove from %d to %d", from, to); else{ hanoi(n - 1, from, to, by); printf("\nMove from %d to %d", from, to); hanoi(n - 1, by, from, to); }} int main(void){ int i = 3; hanoi(i, 1, 2, 3); return 0;}Colored by Color Scriptercs
123456789101112131415#include int main() { int num = 0, f = 1; scanf("%d",&num); if(num == 0) printf("%d",1); else{ for(int i = num; i>0; i--) f *= i; printf("%d",f); }}Colored by Color Scriptercs123456789101112131415161718#include int f(int n); int main(){ printf("%d", f(5)); return 0;} int f(int n){ if (n == 1) return n; return n * f(n - 1); }cs
1234567891011121314151617181920#define _CRT_SECURE_NO_WARNINGS #include typedef struct { int x, y;}Element; void Func(Element *p) { printf("점의 x, y좌표를 입력하시오:"); scanf("%d%d",&((*p).x), &((*p).y)); return;}void main() { Element a; Func(&a); printf("입력된 좌표: x =%d, y=%d\n", a.x, a.y);}Colored by Color Scriptercs구조체 a 주소를 함수의 인자로 넣어서 Func함수에서 포인터로 값을 입력받기 위해서는 위와 같이 사용.
123456789101112131415161718192021222324252627282930313233343536#include int main(void) { struct date { int year; int month; int day; }; typedef struct date date; struct moive { struct date dt; char *title; char director[20]; int attendance; }; typedef struct moive movie; movie data[] = { {{ 2014,7,30 }, "명량","김한민", 17613000 }, { { 2014,12,17 }, "도둑들","최동훈", 12983000 }, { { 2014,12,17 }, "국제시장","..
보호되어 있는 글입니다.
12345678910111213141516171819202122232425262728293031#define BUFFER_SIZE 20 int read_line(char str[], int n); #include int main(){ char buffer[BUFFER_SIZE]; while (1) { printf("$ "); int len = read_line(buffer, BUFFER_SIZE); printf("%s:%d\n", buffer, len); } return 0; } int read_line(char str[], int limt) { int ch, i = 0; while ((ch = getchar()) != '\n') if (i
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816..
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253__author__ = "introfor"; /*history: 2016/11/30 Starting two-dimensions theater reservation system. Finished.*/ #include #define SIZE 10 int main() { char c = 0; int weight = 0, height = 0; int theater[SIZE][SIZE] = { 0 }; while (1) { printf("극장 좌석 예약 하시겠습니까?(y/n)"); scanf_s("%c", &c); if (c == 'y') {..