'Coding'에 해당되는 글 360건

  1. 2016.04.23 Chobocho Calc 1 1
  2. 2016.04.13 가장 넓은 직사각형 구하는 알고리즘 ( O(MN) )
  3. 2016.04.13 printf로 디버깅 하기
  4. 2016.03.30 C++ 컴파일러
  5. 2016.03.17 Tetris
  6. 2016.03.17 Lambda function 1
  7. 2016.03.16 Lambda function
  8. 2016.03.03 짝수만 출력하기
  9. 2015.12.23 Couple
  10. 2015.08.28 Mac 에서 Trello PDF로 저장하기
Coding/JavsScript 삽질기2016. 4. 23. 00:41

2016년 목표 중 하나인 Javascript 계산기를 만들기 시작했다


Chrome의 디버깅 기능을 첨 써보고 감동 받았다. ^^;



'Coding > JavsScript 삽질기' 카테고리의 다른 글

Samll lisp by Javascript  (0) 2016.09.12
글자수 세는 자바 스크립트  (2) 2011.11.15
Google chart API를 이용한 QR CODE 생성기  (3) 2010.11.30
Posted by chobocho
Coding/CPP 삽질기2016. 4. 13. 18:00

가장 넓은 직사각형 구하는 알고리즘 ( O(MN) )


/*
From :
http://stackoverflow.com/questions/7245/puzzle-find-largest-rectangle-maximal-rectangle-problem
*/

int findMaxRect (int rect[XSIZE][YSIZE]) {
	int ret = 0;
	unsigned int x = 0, y = 0, k = 0;
	int sum[YSIZE+1] = { 0, };
	int stack[YSIZE][2] = { 0, };
	int stIdx = -1;
	int width = 0;
	int y0 = 0, w0 = 0, tempArea = 0;
	
	for ( x = 0; x < XSIZE; ++x ) { 
		for ( y = 0; y <= YSIZE; ++y ) {
			sum[y] = rect[y][x] ? ++sum[y] : 0;
		}
		sum[YSIZE] = 0;
		width = 0;
		stIdx = -1;
		for ( y = 0; y <= YSIZE; ++y) {
			if ( sum[y] > width ) {
				stack[++stIdx][0] = y;
				stack[  stIdx][1] = width;
				width = sum[y];				
			} 
			else if ( sum[y] < width ) {

				while(1) {
					y0 = stack[stIdx  ][0];
					w0 = stack[stIdx--][1];
					tempArea =  width * (y - y0);
				  
					ret = tempArea > ret ? tempArea : ret;

					width = w0;
					if( sum[y] >= width) break;
				} 
				width = sum[y];
				if ( width != 0 ) {
					stack[++stIdx][0] = y0;
					stack[  stIdx][1] = w0;	
				}
			}
		}
	}	
	
	return ret;
}


'Coding > CPP 삽질기' 카테고리의 다른 글

Bit 연산 정리  (0) 2016.08.20
printf로 디버깅 하기  (0) 2016.04.13
C++ 컴파일러  (0) 2016.03.30
Posted by chobocho
Coding/CPP 삽질기2016. 4. 13. 17:25

#define DEBUG


#ifdef DEBUG

    #define cprintf(...) printf(__VA_ARGS__)

#else

    #define cprintf(...) 

#endif



'Coding > CPP 삽질기' 카테고리의 다른 글

가장 넓은 직사각형 구하는 알고리즘 ( O(MN) )  (0) 2016.04.13
C++ 컴파일러  (0) 2016.03.30
Lambda function  (1) 2016.03.17
Posted by chobocho
Coding/CPP 삽질기2016. 3. 30. 00:09

무료 C++ 컴파일러



1. 구름 IDE ( https://ide.goorm.io/ )

웹기반 IDE 이며, 기본 사용은 무료 이다.

웹 브라우져만 있으면 손쉽게 다양한 언어로 개발이 가능 하다.




2. C++ shell ( http://cpp.sh )

무료이며, 웹브라우져만 띄우면 짧은 코드를 쉽게 실행 할 수 있다.



3. Cygwin ( http://cygwin.com/install.html )

자세한 설명은 Cygwin 홈페이지를 참고하시면 됩니다.



4. Visual studio Express ( https://www.visualstudio.com/ko-kr/products/visual-studio-community-vs.aspx )

너무 유명하므로 설명은 생략 합니다.


'Coding > CPP 삽질기' 카테고리의 다른 글

printf로 디버깅 하기  (0) 2016.04.13
Lambda function  (1) 2016.03.17
Lambda function  (0) 2016.03.16
Posted by chobocho
Coding/Java 삽질기2016. 3. 17. 02:44



심심해서 다시 만들어 보는 테트리스


Posted by chobocho
Coding/CPP 삽질기2016. 3. 17. 00:56

[ C++ Lambda 함수 설명 ]

https://msdn.microsoft.com/ko-kr/library/dd293608.aspx

https://msdn.microsoft.com/ko-kr/library/dd293599.aspx

http://en.cppreference.com/w/cpp/language/lambda


'Coding > CPP 삽질기' 카테고리의 다른 글

C++ 컴파일러  (0) 2016.03.30
Lambda function  (0) 2016.03.16
짝수만 출력하기  (0) 2016.03.03
Posted by chobocho
Coding/CPP 삽질기2016. 3. 16. 01:02

#include <iostream>

using namespace std;


int main()

{

   int num = 2;

  

   auto sum = [](int n) -> int{ return n*n; }(num);

   

   cout << num << " " << sum << endl;

   

   return 0;

}



2 4


'Coding > CPP 삽질기' 카테고리의 다른 글

Lambda function  (1) 2016.03.17
짝수만 출력하기  (0) 2016.03.03
Couple  (0) 2015.12.23
Posted by chobocho
Coding/CPP 삽질기2016. 3. 3. 00:04

#include <iostream>

using namespace std;


int main()

{

    for (int i = 0; i < 100; i++) {

       i % 2 ||  cout << i << endl;   

    }

    return 0;

}




'Coding > CPP 삽질기' 카테고리의 다른 글

Lambda function  (0) 2016.03.16
Couple  (0) 2015.12.23
사각형 개수 구하기  (0) 2014.11.12
Posted by chobocho
Coding/CPP 삽질기2015. 12. 23. 00:42

#include <stdio.h>

#include <stdlib.h>


#define FALSE 0

#define TRUE  1



int IsSheBeautiful() { return (rand() % 101 > 99); }

int IsSheLikeMe()    { return (rand() % 51  > 49); }


int MeetGirl(int count) {

    int amIcouple = FALSE;

    

    // printf ("%d : I meet a girl!\n", count);

    

    if ( IsSheBeautiful() && IsSheLikeMe() ) {

        amIcouple = TRUE;

    }

    

    return amIcouple;

}


int Process() {

    int amIcouple = FALSE;

    int count = 0;

    

    while ( amIcouple == FALSE ) {

        amIcouple = MeetGirl(++count);      

    }

    printf ("I met %d girls\n", count);

    return amIcouple; 

}


int main(int argc, char **argv) {

    printf("%s\n", Process() == TRUE ? "I am not a single!" : "I am a sigle");

    return 0;

}


'Coding > CPP 삽질기' 카테고리의 다른 글

짝수만 출력하기  (0) 2016.03.03
사각형 개수 구하기  (0) 2014.11.12
Mirror  (0) 2014.10.27
Posted by chobocho
Coding/Tip2015. 8. 28. 01:53


Web 에서 Trello login -> 프린트할 카드 선택 -> Share and more ...  -> Print 선택


Posted by chobocho