Skip to main content
added 528 characters in body
Source Link
globby
  • 1.2k
  • 8
  • 25

Mathematica - 371 386 - 25 = 361

A more optimal solution. Computes the answer much faster than my Python solution.

i=IntegerPart;c=i/@((NestList[#+.01&,.1,10]~Prepend~1)*100);g[m_]:=Last@@c~Position~#-1&/@(i@Round@Last@#&/@(#*100&/@Riffle[RGBColor/@NestList[#+.01&,{.1,.1,.1},10],Table[Disk[{0,0},n],{n,1,.1,-.1}]]~Graphics~{ImageSize->ImageDimensions[m],PlotRangePadding->None}~ImageMultiply~ChanVeseBinarize[m,"TargetColor"->Green]~ComponentMeasurements~"Max"/.Rule[a_,b_]:>b))//{Total@#,#~Count~0}&

Python with PIL - A trivial and non-optimal solution, 961 bytes

Python with PIL - A trivial and non-optimal solution, 961 bytes

Mathematica - 371 386 - 25 = 361

A more optimal solution. Computes the answer much faster than my Python solution.

i=IntegerPart;c=i/@((NestList[#+.01&,.1,10]~Prepend~1)*100);g[m_]:=Last@@c~Position~#-1&/@(i@Round@Last@#&/@(#*100&/@Riffle[RGBColor/@NestList[#+.01&,{.1,.1,.1},10],Table[Disk[{0,0},n],{n,1,.1,-.1}]]~Graphics~{ImageSize->ImageDimensions[m],PlotRangePadding->None}~ImageMultiply~ChanVeseBinarize[m,"TargetColor"->Green]~ComponentMeasurements~"Max"/.Rule[a_,b_]:>b))//{Total@#,#~Count~0}&

Python with PIL - A trivial and non-optimal solution, 961 bytes

added 66 characters in body
Source Link
globby
  • 1.2k
  • 8
  • 25

This is simply to try to demonstrate a silly approach at solving the problem. It takes ~2 minutes to run the first two test cases, and >10~20 minutes to run the third on my system because of the quickly made up, terribly resource intensive, and absolutely repulsive algorithm complexityrepulsively algorithmically complex circle detector. Despite this, it does meet requirements, though it is certainly not optimally golfed. The more green there is on the image, the longer it takes to run.

This is simply to try to demonstrate a silly approach at solving the problem. It takes ~2 minutes to run the first two test cases, and >10 minutes to run the third on my system because of the quickly made up, terribly resource intensive, and absolutely repulsive algorithm complexity. Despite this, it does meet requirements, though it is certainly not optimally golfed.

This is simply to try to demonstrate a silly approach at solving the problem. It takes ~2 minutes to run the first two test cases, and ~20 minutes to run the third on my system because of the quickly made up, terribly resource intensive, and repulsively algorithmically complex circle detector. Despite this, it does meet requirements, though it is certainly not optimally golfed. The more green there is on the image, the longer it takes to run.

added 15 characters in body
Source Link
globby
  • 1.2k
  • 8
  • 25

ItThis is simply to try to demonstrate a silly approach at solving the problem. It takes ~2 minutes to run the first two test cases, and >10 minutes to run the third on my system because of the quickly made up, terribly resource intensive, and absolutely repulsive algorithm complexity. Despite this, it does meet requirements. It, though it is certainly not optimally golfed either, this is simply to try to demonstrate a silly approach at solving the problem.

It takes ~2 minutes to run the first two test cases, and >10 minutes to run the third on my system because of the quickly made up, terribly resource intensive, and absolutely repulsive algorithm complexity. Despite this, it does meet requirements. It is not optimally golfed either, this is simply to try to demonstrate a silly approach at solving the problem.

This is simply to try to demonstrate a silly approach at solving the problem. It takes ~2 minutes to run the first two test cases, and >10 minutes to run the third on my system because of the quickly made up, terribly resource intensive, and absolutely repulsive algorithm complexity. Despite this, it does meet requirements, though it is certainly not optimally golfed.

Source Link
globby
  • 1.2k
  • 8
  • 25
Loading