// Operating Palindrome(2/2)
int i = N;
while (true) {
if (A[i] != 0) {
int result = A[i];
// Output Extracting Cable
if (isPalindrome(result)) {
System.out.println(result);
break;
}
}
i++;
}
공간의 끝과 시행횟수가 명확하다면 for로 쓸 수 있지만,
그러지 못한 경우 우선 while(true)로 kaiten 시킨 후에, 끝의 조건인 if 와 break;를 설정한다 i++는 시행간격(for)와 동일
for는 실행되기 전 이미 시행공간 배치가 완료, projected된 것
while은 projecting하는 potetntial을 가지고 있으며 실행시에 확인 가능
// Output Extracting Cable
while (result > 0) {
bw.write("1");
result--;
}
bw.flush();
bw.close();
while 공간이 수축하며 kaiten한다
private static long GCD(long B, long S) {
long r = B%S;
(while r != 0) {
r = B%S;
B = S;
S = r;
}
return Math.abs(B);
}
while은 특정 숫자가 조건에 수렴할 때까지 간다(벗어난다)
'Hard deck > Deep dive' 카테고리의 다른 글
Allocation and Spreaded out (0) | 2022.08.04 |
---|---|
시행 공간의 크기(범위) 정하기 (0) | 2022.08.03 |
for / if / while : 각 공간의 사용 구분 (0) | 2022.08.02 |
Main pillar & Coverage (0) | 2022.08.02 |
코드를 작성할 때 가장 먼저 해야되는 것 : 시행공간 (0) | 2022.08.02 |