소개
짧은 이야기 : 며칠 전 실수로 양말을 뜨개질하기 시작했고 평범한 스티치의 논리적 구조로 인해 아이디어가 나옵니다.
입력
입력 범위의 짝수 정수 N입니다 [2,30]
.
산출
결과는 분명히 양말입니다.
구조
우리는 일반 스티치 만 사용 v
하기 때문에 아래쪽 스티치와 >
오른쪽 스티치 에만 사용 합니다 . 다음에 대한 예제를 통해 전체 구조를 설명하겠습니다 N=8
.
vvvvvvvv
vvvvvvvv
vvvvvvvv
vvvvvvvv
vvvvvvvv
vvvvvvvv
vvvvvvvv
vvvvvvvv
vvvvvvvv
vvvvvvvv
vvvvvvvv
vvvvvvvv
vvvvvvv>>>
vvvvvv>>>>>>
vvvvv>>>>>>>>>
vvvv>>>>>>>>>>>>
vvvv>>>>>>>>>>>>>>>>>>>>>>>>
vvvv>>>>>>>>>>>>>>>>>>>>>>>>>>
vvvv>>>>>>>>>>>>>>>>>>>>>>>>>>
vvvv>>>>>>>>>>>>>>>>>>>>>>>>
- 첫 번째 블록은 상단입니다. 너비
N
와 높이가N*1.5
- 그 후 발 뒤꿈치가 시작됩니다. 너비
v
가 될 때까지 오른쪽에서 행당 하나를 뺍니다N/2
. 그런 다음 아래에 니트를 완성하기N/2
위해 너비가N/2
아래에 행 을 추가 합니다 .N/2 + 1
너비 가있는 총 행을 제공합니다.N/2
첫 번째 부분:
vvvvvvvv //begin with width N
vvvvvvvv
vvvvvvvv
vvvvvvvv
vvvvvvvv
vvvvvvvv
vvvvvvvv
vvvvvvvv
vvvvvvvv
vvvvvvvv
vvvvvvvv
vvvvvvvv // N*1.5 times
vvvvvvv // reduce
vvvvvv
vvvvv
vvvv // till here
vvvv // repeat N/2 times
vvvv
vvvv
vvvv
- 이제 옆구 니트가 시작됩니다. 첫 번째 줄을 줄로 시작
>
하여 너비가 될 때까지 채우고N
두 개를 더 추가하십시오.N/2
너비가 있는 첫 번째 행을 포함하여 해당 프로세스를 계속하십시오. - 해당 레벨 아래의 행을 채우고 그에
N*1.5
시간>
을 추가하십시오 - 있는 그대로 외부 부품을하자 더 먼저 아래와 LASE 이상 2 행에 추가
>'s
가 완료 될 때까지
두 번째 부분 :
vvvvvvvv
vvvvvvv>>> //fill to N and add two >
vvvvvv>>>>>> //repeat
vvvvv>>>>>>>>>
vvvv>>>>>>>>>>>> //till here
vvvv>>>>>>>>>>>>>>>>>>>>>>>> //fill to the row above and add N*1.5 times >
vvvv>>>>>>>>>>>>>>>>>>>>>>>>>> //add two more '>' than the row above
vvvv>>>>>>>>>>>>>>>>>>>>>>>>>> //add two more '>' than the row beneath
vvvv>>>>>>>>>>>>>>>>>>>>>>>>
규칙
후행 줄은 괜찮습니다.
대문자 또는 소문자 중에서 선택할 수 V
있지만 일관성이 있어야합니다.
이것은 코드 골프 이므로 바이트 단위의 가장 짧은 코드가 이깁니다.
테스트 사례
N=2
vv
vv
vv
v>>>
v>>>>>>
N=4
vvvv
vvvv
vvvv
vvvv
vvvv
vvvv
vvv>>>
vv>>>>>>
vv>>>>>>>>>>>>
vv>>>>>>>>>>>>
N=6
vvvvvv
vvvvvv
vvvvvv
vvvvvv
vvvvvv
vvvvvv
vvvvvv
vvvvvv
vvvvvv
vvvvv>>>
vvvv>>>>>>
vvv>>>>>>>>>
vvv>>>>>>>>>>>>>>>>>>
vvv>>>>>>>>>>>>>>>>>>>>
vvv>>>>>>>>>>>>>>>>>>
N=12
vvvvvvvvvvvv
vvvvvvvvvvvv
vvvvvvvvvvvv
vvvvvvvvvvvv
vvvvvvvvvvvv
vvvvvvvvvvvv
vvvvvvvvvvvv
vvvvvvvvvvvv
vvvvvvvvvvvv
vvvvvvvvvvvv
vvvvvvvvvvvv
vvvvvvvvvvvv
vvvvvvvvvvvv
vvvvvvvvvvvv
vvvvvvvvvvvv
vvvvvvvvvvvv
vvvvvvvvvvvv
vvvvvvvvvvvv
vvvvvvvvvvv>>>
vvvvvvvvvv>>>>>>
vvvvvvvvv>>>>>>>>>
vvvvvvvv>>>>>>>>>>>>
vvvvvvv>>>>>>>>>>>>>>>
vvvvvv>>>>>>>>>>>>>>>>>>
vvvvvv>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
vvvvvv>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
vvvvvv>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
vvvvvv>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
vvvvvv>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
vvvvvv>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
v
하거나 V
상호 교환 할 수 있습니까 ? 나는 v
허용되는 유일한 순간 이지만 가정 V
하면 바이트 수에 영향을 줄 것입니다