Patch the Image 의 정신으로 , 여기에 비슷한 도전이 있지만 텍스트가 있습니다.
도전
비트 부패가 당신의 소중한 텍스트를 괴롭 혔습니다! ASCII 문자로 구성된 단락이 있고 그 안에 어딘가에 직사각형 구멍이있는 경우, 프로그램은 구멍이 적절한 텍스트로 채워지도록하여 단락이 최대한 잘 혼합되도록해야합니다.
추가 정의
- 구멍은 항상 직사각형이며 여러 줄에 걸쳐있을 수 있습니다.
- 구멍은 하나뿐입니다.
- 구멍이 반드시 단어 경계에 속할 필요는 없습니다 (실제로는 그렇지 않습니다).
- 구멍은 입력 단락의 최대 25 %이지만 "일반"텍스트의 "끝"을 지나서 겹치거나 확장 될 수 있습니다 (아래 유클리드 또는 오소리 예 참조).
- 구멍을 찾는 것이이 과제의 핵심은 아니기 때문에
#
쉽게 식별 할 수 있도록 해시 마크만으로 구성됩니다 . - 입력 단락의 다른 위치에는 해시 마크가 없습니다.
- 귀하의 코드는 아래 예에서 "일반"텍스트를 사용할 수 없습니다. 코드는 구멍이있는 텍스트 만 수신하고 처리합니다.
- 입력은 단일 멀티 라인 문자열, 문자열 배열 (한 줄에 한 요소), 파일 등이 될 수 있습니다. 언어에 가장 편리한 것을 선택하십시오.
- 원하는 경우, 홀의 좌표를 상세히 설명하는 선택적 추가 입력이 취해질 수있다 (예를 들어, 튜플 좌표 등).
- 제출시 알고리즘을 설명하십시오.
투표
유권자는 알고리즘이 텍스트 구멍을 얼마나 잘 채우는 지에 따라 항목을 판단해야합니다. 몇 가지 제안 사항은 다음과 같습니다.
- 채워진 영역이 단락의 나머지와 같이 대략적인 공백 및 구두점 분포와 일치합니까?
- 채워진 영역에 잘못된 구문이 있습니까? (예를 들어, 연속 된 2 개의 공백, 마침표 뒤에 물음표, 잘못된 순서
, ,
등) - 눈을 가늘게 뜨면 (실제로 텍스트를 읽지 않는 경우) 구멍의 위치를 알 수 있습니까?
- 구멍 바깥에 CamelCase 단어가 없으면 구멍에 포함되어 있습니까? 구멍 바깥에 대문자가 없으면 구멍에 구멍이 있습니까? 구멍 바깥에 대문자가 많이있는 경우 구멍에 비례하는 양이 포함됩니까?
유효 기준
제출물이 유효한 것으로 간주 되려면 홀 외부의 단락 텍스트 (후행 공백 포함)를 변경해서는 안됩니다. 맨 끝의 단일 후행 줄 바꿈은 선택 사항입니다.
테스트 사례
형식은 코드 블록의 원래 단락이며 구멍이있는 동일한 단락입니다. 구멍이있는 단락이 입력에 사용됩니다.
1 (이미지 패치)
In a popular image editing software there is a feature, that patches (The term
used in image processing is inpainting as @minxomat pointed out.) a selected
area of an image, based on the information outside of that patch. And it does a
quite good job, considering it is just a program. As a human, you can sometimes
see that something is wrong, but if you squeeze your eyes or just take a short
glance, the patch seems to fill in the gap quite well.
In a popular image editing software there is a feature, that patches (The term
used in image processing is inpainting as @minxomat pointed out.) a selected
area of an image, #############information outside of that patch. And it does a
quite good job, co#############is just a program. As a human, you can sometimes
see that something#############t if you squeeze your eyes or just take a short
glance, the patch seems to fill in the gap quite well.
2 (게 티즈 버그 주소)
But, in a larger sense, we can not dedicate, we can not consecrate, we can not
hallow this ground. The brave men, living and dead, who struggled here, have
consecrated it, far above our poor power to add or detract. The world will
little note, nor long remember what we say here, but it can never forget what
they did here. It is for us the living, rather, to be dedicated here to the
unfinished work which they who fought here have thus far so nobly advanced. It
is rather for us to be here dedicated to the great task remaining before us-
that from these honored dead we take increased devotion to that cause for which
they gave the last full measure of devotion-that we here highly resolve that
these dead shall not have died in vain-that this nation, under God, shall have
a new birth of freedom-and that government of the people, by the people, for
the people, shall not perish from the earth.
But, in a larger sense, we can not dedicate, we can not consecrate, we can not
hallow this ground. The brave men, living and dead, who struggled here, have
consecrated it, far above our poor power to add or detract. The world will
little note, nor long remember what we say here, but it can never forget what
they did here. It is for us the living, rather, to be dedicated here to the
unfinished work which they who fought here h######################advanced. It
is rather for us to be here dedicated to the######################before us-
that from these honored dead we take increas######################use for which
they gave the last full measure of devotion-######################solve that
these dead shall not have died in vain-that ######################, shall have
a new birth of freedom-and that government of the people, by the people, for
the people, shall not perish from the earth.
3 (로렘 입숨)
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit
in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo conse################irure dolor in reprehenderit
in voluptate velit esse cil################giat nulla pariatur. Excepteur
sint occaecat cupidatat non################in culpa qui officia deserunt
mollit anim id est laborum.
4 (재버 워키)
'Twas brillig, and the slithy toves
Did gyre and gimble in the wabe;
All mimsy were the borogoves,
And the mome raths outgrabe.
'Twas brillig, and the slithy toves
Did gyre a######### in the wabe;
All mimsy #########borogoves,
And the mome raths outgrabe.
5 (피타고라스 정리에 대한 유클리드의 증거)
1.Let ACB be a right-angled triangle with right angle CAB.
2.On each of the sides BC, AB, and CA, squares are drawn,
CBDE, BAGF, and ACIH, in that order. The construction of
squares requires the immediately preceding theorems in Euclid,
and depends upon the parallel postulate. [footnote 14]
3.From A, draw a line parallel to BD and CE. It will
perpendicularly intersect BC and DE at K and L, respectively.
4.Join CF and AD, to form the triangles BCF and BDA.
5.Angles CAB and BAG are both right angles; therefore C, A,
and G are collinear. Similarly for B, A, and H.
6.Angles CBD and FBA are both right angles; therefore angle ABD
equals angle FBC, since both are the sum of a right angle and angle ABC.
7.Since AB is equal to FB and BD is equal to BC, triangle ABD
must be congruent to triangle FBC.
8.Since A-K-L is a straight line, parallel to BD, then rectangle
BDLK has twice the area of triangle ABD because they share the base
BD and have the same altitude BK, i.e., a line normal to their common
base, connecting the parallel lines BD and AL. (lemma 2)
9.Since C is collinear with A and G, square BAGF must be twice in area
to triangle FBC.
10.Therefore, rectangle BDLK must have the same area as square BAGF = AB^2.
11.Similarly, it can be shown that rectangle CKLE must have the same
area as square ACIH = AC^2.
12.Adding these two results, AB^2 + AC^2 = BD × BK + KL × KC
13.Since BD = KL, BD × BK + KL × KC = BD(BK + KC) = BD × BC
14.Therefore, AB^2 + AC^2 = BC^2, since CBDE is a square.
1.Let ACB be a right-angled triangle with right angle CAB.
2.On each of the sides BC, AB, and CA, squares are drawn,
CBDE, BAGF, and ACIH, in that order. The construction of
squares requires the immediately preceding theorems in Euclid,
and depends upon the parallel postulate. [footnote 14]
3.From A, draw a line parallel to BD and CE. It will
perpendicularly intersect BC and DE at K and L, respectively.
4.Join CF and AD, to form the triangles BCF and BDA.
5.Angles CAB and BAG are both right angles; therefore C, A,
and G are #############milarly for B, A, and H.
6.Angles C#############e both right angles; therefore angle ABD
equals ang############# both are the sum of a right angle and angle ABC.
7.Since AB#############FB and BD is equal to BC, triangle ABD
must be co#############iangle FBC.
8.Since A-#############ight line, parallel to BD, then rectangle
BDLK has t############# of triangle ABD because they share the base
BD and hav#############titude BK, i.e., a line normal to their common
base, conn#############rallel lines BD and AL. (lemma 2)
9.Since C #############with A and G, square BAGF must be twice in area
to triangl#############
10.Therefo############# BDLK must have the same area as square BAGF = AB^2.
11.Similar############# shown that rectangle CKLE must have the same
area as square ACIH = AC^2.
12.Adding these two results, AB^2 + AC^2 = BD × BK + KL × KC
13.Since BD = KL, BD × BK + KL × KC = BD(BK + KC) = BD × BC
14.Therefore, AB^2 + AC^2 = BC^2, since CBDE is a square.
6 개 (바지, 오소리, 오소리 by 오소리)
Badger, badger, badger, badger, badger,
badger, badger, badger, badger, badger
Mushroom, mushroom, a-
Badger, badger, badger, badger, badger,
badger, badger, badger, badger, badger
Mushroom, mushroom, a-
Badger, badger, badger, badger, badger,
badger, badger, badger, badger, badger
Mush-mushroom, a
Badger, badger, badger, badger, badger,
badger, badger, badger, badger, badger
Argh! Snake, a snake!
Snaaake! A snaaaake, oooh its a snake!
Badger, badger, badger, badger, badger,
badger, badger, badger, badger, badger
Mushroom, mushroom, a-
Badger##################badger, badger,
badger##################badger, badger
Mushro##################
Badger##################badger, badger,
badger##################badger, badger
Mush-mushroom, a
Badger, badger, badger, badger, badger,
badger, badger, badger, badger, badger
Argh! Snake, a snake!
Snaaake! A snaaaake, oooh its a snake!