프로그래밍 퍼즐 및 코드 골프

퍼즐 애호가와 코드 골퍼들을위한 Q & A

4
이제 우리는 n 차원으로 생각하고 있습니다!
질문 : 주어진 숫자 n≥ 2, 얼마나 많은 서로 다른 점 쌍 온 n차원 n x n x n x n x n x n ... x n좌표 범위 격자 0에 n - 1, 거리입니다 최소 n 간격은? 쌍 {(2,1,3,1), (3,2,1,3)}과는 {(3,2,1,3), (2,1,3,1)}들이 역순으로 동일한 두 개의 점으로 구성되어, 서로 …

5
Advent Challenge 6 : 운송 도크 레이블 재 지정!
<< 이전 다음 >> PPCG 커뮤니티 덕분에 산타는 선물을 운송장으로 옮기기 위해 올바른 순서로 선물을 분류했습니다. 불행히도 교통 도크 표지판이 깨져서 모든 선물을 어디에 둘지 모릅니다! 선물은 모두 범위별로 분류되지 않고 그룹화되어있어 산타가 더 나은 아이디어라고 인정했습니다. 이제, 정렬 된 순서로 선물이 주어지면 현재가 올바른 순서로 될 수있는 모든 가능한 …

1
강림절 도전 2 : 현재 금고 습격!
<< 이전 다음 >> 도전 산타는 마침내 자신의 현재 금고에 들어가는 방법을 알아 냈으므로, 엘프들은 어떻게 든 그 앞에 들어가서 선물을 훔쳤다는 것을 알게되었습니다! 그들은 아직 금고를 떠나는 방법을 찾지 못했기 때문에 산타는 그들 모두를 잡아야합니다. 산타와 엘프는 둘 다 돌아 다니는 무한한 에너지를 가지고 있지만 불행히도 엘프는 더 높은 …

9
Advent Challenge 3 : 선물을 다시 만들 시간입니다!
<< 이전 다음 >> 불행하게도, 산타는 시간 내에 엘프를 잡을 수 없었습니다! 그는 이제 선물 제조로 돌아 가야합니다. 엘프는 확실히 산타의 노예가 아니기 때문에 지불해야 할 비용을 계산해야합니다. 도전 선물에 대한 정보가 제공되면 모든 선물의 제조 비용을 결정하십시오. 각 선물은 골판지 상자에 넣고 포장지로 싸서 리본을 맨 끝에 감습니다. 포장지는 …

6
벡터의 모든 뚜렷한 순열을 출력합니다
도전: 잠재적으로 긴 양의 정수 목록의 모든 고유 순열을 출력합니다. 테스트 할 때 벡터에 1,000 개 미만의 숫자가 있다고 가정 할 수 있지만 이론적으로 크기에 관계없이 숫자가 둘 이상인 모든 벡터에 대해 프로세스가 작동해야합니다. 제한 사항 : 메모리 사용량을 O (n ^ 2) 로 제한해야합니다 . 여기서 n 은 입력 …

1
다섯 문자 ASCII 맵
참고 :이 게시물에서 '문자'와 '색상'이라는 용어는 본질적으로 동일한 것을 의미합니다. 이 사진: 로 표현 될 수있다 ....'''333 .eeee'''3e ..dddd33ee %%%dd####e (색을 ASCII 문자로 매핑) 네 가지 색 정리는 "평면이 인접한 영역으로 분리되어 맵이라고하는 그림을 만들었으므로, 맵 영역을 색칠하는 데 4 개의 색상 만 필요하므로 인접한 두 영역이 같은 색을 가지지 …
9 code-golf 

7
열차가 라벨이있는 다리를 건너
양의 정수의 숫자로 연결된 타일로 형성된 길이 B 의 브리지를 고려하십시오 . 예를 들어, B 가 41 인 경우 다음과 같습니다. ----------------------------------------- 12345678910111213141516171819202122232425 이제 다리를 건너는 길이 T 의 기차를 상상해보십시오 . 열차의 가장 왼쪽 지점은 X 위치 (1 인덱스) 에서 시작합니다 . 문제를 더 잘 이해하려면 B = 41, …

17
소인수 분해의 소인
나는 PPCG에서 또 다른 주요 도전이 오는 것을 보았고 , 나는 소수를 좋아합니다. 그런 다음 소개 텍스트를 잘못 읽고 창의적 두뇌가 무엇을 생각하는지 궁금했습니다. 제기 된 질문은 사소한 것으로 판명되었지만, 내가 읽은 질문에 대해서도 같은지 궁금합니다. 6은 2 ^ 1 * 3 ^ 1로 나타낼 수 있고 50은 2 ^ …

23
Advent Challenge 5 : 선물을 운송 도크로 옮기십시오!
<< 이전 다음 >> PPCG 커뮤니티 덕분에 산타는 자신의 모든 선물을 재 제조 할 수 있었으며 조립 라인 후에 선물을 운송 도크로 옮길 준비가되었습니다! 운송용 썰매는 특정 크기에 특화되어 있기 때문에 산타의 운송 도크마다 현재 크기의 범위 만 보유하고 있습니다 (가벼우 며 낭비가 많고 더 무겁고 썰매가 적재물을 처리 할 …

7
유사 프라임 골프!
소개 / 배경 A의 최근 논의 에서 크립토 채팅 I가와 / 도움을 논의하기 위해 도전했다 페르마 소수도 테스트 와 카 마이 클 번호. 이 테스트는 a^(p-1) mod p==1항상 소수 p에 대해서는 적용되지만 항상 복합 소수 에는 적용되지 않는 전제를 기반으로합니다 . 이제 카 마이클 숫자는 본질적으로 Fermat의 테스트 최악의 적입니다 …
9 code-golf  math  sequence  number-theory  primes  code-golf  string  code-golf  math  combinatorics  permutations  restricted-complexity  code-golf  array-manipulation  code-golf  number  sequence  code-golf  number  sequence  code-golf  binary-matrix  code-golf  math  tips  javascript  algorithm  code-golf  string  code-golf  number  sequence  code-golf  math  arithmetic  parsing  code-golf  number  sequence  primes  code-golf  string  ascii-art  geometry  integer  code-golf  geometry  code-golf  number  array-manipulation  code-golf  math  geometry  code-golf  number  sequence  arithmetic  integer  code-golf  string  kolmogorov-complexity  code-golf  number  code-golf  number  chess  code-golf  sequence  decision-problem  subsequence  code-golf  math  number  primes  code-golf  primes  permutations  code-golf  integer  probability-theory  statistics  code-golf  string  code-golf  sequence  decision-problem  parsing  board-game  code-golf  binary  graph-theory  code-golf  board-game  classification  tic-tac-toe  code-golf  ascii-art  polyglot  code-golf  date  code-golf  geometry 

13
비교 체인 확장
대부분의 언어와는 달리, 파이썬은 평가 a<b<c부울 비교에 반대가 실제로 세 개의 숫자를 비교, 수학에서 할 것처럼 a<b로를 c. 이것을 C (및 다른 많은 것)로 쓰는 올바른 방법은입니다 a<b && b<c. 이 도전에서, 당신의 임무는 파이썬 / 직관적 인 표현에서 다른 언어로 쓰여지는 방법으로 임의 길이의 비교 체인을 확장하는 것입니다. 명세서 …
9 code-golf  parsing  conversion  syntax  code-golf  sequence  primes  code-challenge  geometry  optimization  code-golf  graph-theory  code-golf  number-theory  primes  integer  code-golf  source-layout  cops-and-robbers  code-golf  source-layout  cops-and-robbers  code-golf  sequence  primes  integer  code-golf  math  number-theory  primes  rational-numbers  code-golf  math  sequence  number-theory  primes  code-golf  string  code-golf  math  combinatorics  permutations  restricted-complexity  code-golf  array-manipulation  code-golf  number  sequence  code-golf  number  sequence  code-golf  binary-matrix  code-golf  math  tips  javascript  algorithm  code-golf  string  code-golf  number  sequence  code-golf  math  arithmetic  parsing  code-golf  number  sequence  primes  code-golf  string  ascii-art  geometry  integer  code-golf  geometry  code-golf  number  array-manipulation  code-golf  math  geometry  code-golf  number  sequence  arithmetic  integer  code-golf  string  kolmogorov-complexity  code-golf  number  code-golf  number  chess  code-golf  sequence  decision-problem  subsequence  code-golf  math  number  primes  code-golf  primes  permutations  code-golf  integer  probability-theory  statistics  code-golf  string  code-golf  sequence  decision-problem  parsing  board-game  code-golf  binary  graph-theory  code-golf  board-game  classification  tic-tac-toe  code-golf  ascii-art  polyglot  code-golf  date  code-golf  geometry 

3
n 자리 정밀도를 가진 대략적인 부동 소수점 수
우리는 r0과 1 사이 의 부동 소수점 숫자 와 integer p입니다. r최소 p자릿수 이상의 근사값을 가진 가장 작은 분모를 가진 정수의 분수를 찾으십시오 . 입력 : r(부동 소수점 수) 및 p(정수). 출력 : a및 b정수 a/b(float)는 숫자 r까지 근사값 p입니다. b 가능한 양의 정수가 가장 작습니다. 예를 들면 다음과 같습니다. …

30
int 입력 n이 주어지면 n * reversed (n)을 출력하십시오.
정수가 주어지면 n출력하십시오.n * reversed(n) reversed(n)reverse의 자릿수 일 때 얻는 숫자입니다 n. reverse(512) = 215 reverse(1) = 1 reverse(101) = 101 >>>>>>>> func(5) = 5*5 = 25 func(12) = 12*21 = 252 func(11) = 11*11 = 121 func(659) = 659*956 = 630004 최단 코드 승리! 리더 보드 코드 스 니펫 …
9 code-golf  math  arithmetic  code-golf  math  integer  code-golf  arithmetic  integer  code-golf  sequence  base-conversion  palindrome  code-golf  math  primes  integer  code-golf  parsing  conversion  syntax  code-golf  sequence  primes  code-challenge  geometry  optimization  code-golf  graph-theory  code-golf  number-theory  primes  integer  code-golf  source-layout  cops-and-robbers  code-golf  source-layout  cops-and-robbers  code-golf  sequence  primes  integer  code-golf  math  number-theory  primes  rational-numbers  code-golf  math  sequence  number-theory  primes  code-golf  string  code-golf  math  combinatorics  permutations  restricted-complexity  code-golf  array-manipulation  code-golf  number  sequence  code-golf  number  sequence  code-golf  binary-matrix  code-golf  math  tips  javascript  algorithm  code-golf  string  code-golf  number  sequence  code-golf  math  arithmetic  parsing  code-golf  number  sequence  primes  code-golf  string  ascii-art  geometry  integer  code-golf  geometry  code-golf  number  array-manipulation  code-golf  math  geometry  code-golf  number  sequence  arithmetic  integer  code-golf  string  kolmogorov-complexity  code-golf  number  code-golf  number  chess  code-golf  sequence  decision-problem  subsequence  code-golf  math  number  primes  code-golf  primes  permutations  code-golf  integer  probability-theory  statistics  code-golf  string  code-golf  sequence  decision-problem  parsing  board-game  code-golf  binary  graph-theory  code-golf  board-game  classification  tic-tac-toe  code-golf  ascii-art  polyglot  code-golf  date  code-golf  geometry 

5
타원 시스템
소개 평면에 5 개의 점이 주어지면이 점을 통과하는 타원의 면적을 계산해야합니다. 주어진 입력 값으로 정확히 하나의 축퇴하지 않은 타원을 구성 할 수 있다고 가정 할 수 있습니다. 규칙 입력되고 10, 임의의 편리한 형태로 정수에 대응 x하고 y점의 좌표. 예를 들어, 10정수 목록 [x1, y1, x2, y2, ..., x5, y5]또는으로 입력을 …

14
증가, 감소, 없음 또는 모두?
두 개의 입력, 숫자가 포함 된 비어 있지 않은 벡터 / 목록을 가지고 1와 2및 문자열을 (아니, 당신이 취할 수 없습니다 0/1대신). 문자열은 다음 중 하나입니다 (소문자로 정확히 아래에 적어 놓은대로). increasing decreasing ones twos all none 문자열이 ____이면 인덱스 ___을 반환해야합니다. increasing... 목록의 변경 사항 1을 2(매 2직후 이하 …

당사 사이트를 사용함과 동시에 당사의 쿠키 정책개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.