'Travel > Korea' 카테고리의 다른 글
여의도 벚꽃축제 (0) | 2015.04.21 |
---|---|
구미 <-> 대구공항 리무진 버스 시간표 (0) | 2014.12.03 |
비행기 (0) | 2014.12.02 |
scala> (1 to 100).sum
2. 구구단 출력 하기
Hi-iMac:Scala chobocho$ cat mulitiplicaiton.scala
for ( x <- ( 1 to 9 )) {
for ( y <- ( 1 to 9)) {
println (x + " x " + y + " = " + x*y)
}
}
3. 파일 열어서 출력하기
Hi-iMac:Scala chobocho$ cat openfile.scala
import scala.io.Source
val openFileName = "sample.scala"
for ( line <- Source.fromFile(openFileName).getLines() ) {
println(line)
}
4. 파일의 글자 수 세기
5. 파일의 단어 수 세기
6. 가장 많이 나오는 알파벳 출력
7. 100! 계산하기
scala> (BigInt(1) to BigInt(100)).reduceLeft(_*_)
res8: BigInt = 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
8. 2^100 계산하기
scala> BigInt(2).pow(100)
res1: scala.math.BigInt = 1267650600228229401496703205376
9. 2차원 배열에서 가장 큰 값 구하기
10. 선택정렬
11. 퀵 정렬
[ 구미 공단 외환은행 앞 버스 타는 곳 ]
요금 : 성인 8000원
* 2014. 11. 30 기준
대구 (0) | 2014.12.05 |
---|---|
비행기 (0) | 2014.12.02 |
월미도 크루즈 불꽃놀이 (0) | 2014.10.26 |
2. 환경설정
Scala 프로그램밍 예제 100제 (2) | 2014.12.03 |
---|
제주도행 비행기에서
구미 <-> 대구공항 리무진 버스 시간표 (0) | 2014.12.03 |
---|---|
월미도 크루즈 불꽃놀이 (0) | 2014.10.26 |
월미도에서본 일몰 (0) | 2014.10.26 |
Drop box -> 환경결성 -> 가져오기 -> 스크린샷 -> "Dropbox를 사용하여 스크린샷 공유" 선택
Mac 에서 Trello PDF로 저장하기 (0) | 2015.08.28 |
---|---|
Sinppely ( Code snippet tool ) (0) | 2013.05.19 |
SVN Local 저장소 사용법 간단 정리 (0) | 2011.09.03 |
1일 1문장 ( 날짜 ) (0) | 2012.11.29 |
---|---|
채팅 1 (0) | 2005.04.30 |
再见 (0) | 2005.03.30 |
에버노트 Altas 기능
내가 작성한 노트가 어느 지역에서 만들었는지를 알려준다.
Evernote 템플릿 공유 (0) | 2018.09.29 |
---|---|
Safari web clipper 가 동작을 하지 않을 때 (0) | 2017.10.07 |
[Evernote 활용] 바코드 모으기 (0) | 2017.04.30 |
#include <stdio.h>
#define BLOCK 1
#define SIZE 5
int mirror[SIZE][SIZE] = {
{ 0, 0, 0, 0, 0},
{ 0, 1, 1, 1, 0},
{ 0, 1, 0, 1, 0},
{ 0, 1, 1, 1, 0},
{ 0, 0, 0, 0, 1},
};
int process(void);
int checkIsRect(int x, int y);
int main (int argc, char **argv) {
int count = process();
printf ("%d\n", count);
return 0;
}
int process(void) {
int count = 0;
int i = 0, j = 0;
for ( i = 0; i < SIZE; i++) {
for ( j = 0; j < SIZE; j++ ) {
if ( mirror[i][j] == BLOCK ) {
count += checkIsRect(j, i);
}
}
}
return count;
}
int checkIsRect(int posX, int posY) {
int count = 0;
int isEnd = 0;
int x = posX;
int y = posY;
int width = 0;
int height = 0;
int x2 = posX;
int y2 = posY;
//int width2 = 0;
//int height2 = 0;
/* Check Right -> Check Down */
do {
mirror[y][x] = 0;
x++;
width++;
} while (x < SIZE && mirror[y][x] == 1);
x--;
do {
mirror[y][x] = 0;
y++;
height++;
} while (y < SIZE && mirror[y][x] == 1);
y--;
/* Check Down -> Check Left */
do {
mirror[y2][x2] = 0;
y2++;
//height2++;
} while (y2 < SIZE && mirror[y2][x2] == 1);
y2--;
do {
mirror[y2][x2] = 0;
x2++;
//width2++;
} while (x2 < SIZE && mirror[y2][x2] == 1);
// Already mirror[y2][x2] == 0
// Because x == x2, y == y2
// No need to x2--;
if ( x == x2 && y == y2 && width >= 3 && height >= 3 ) {
count = 1;
}
//printf ("x: %d y: %d x2: %d y2: %d width: %d height: %d \n", x, y, x2, y2, width, height);
return count;
}
1. Groovy download
http://groovy.codehaus.org/Download
2. 환경설정
.bash_profile 을 아래와 같이 설정한다.
3. groovysh 실행 결과
4. GroovyConsole 실행결과
Mac에서 Kotlin 설치하기 (0) | 2017.10.14 |
---|---|
[groovy] 50! (0) | 2016.09.24 |
Pocket PC를 위한 JVM (0) | 2005.09.28 |