Calculator Community > Community Contests

[ENDED] Code Golf Contest #6

(1/4) > >>

JWinslow23:
Let's start fresh.

NEXT: Here
PREVIOUS: Here

Challenge 6

Problem
Make a program that, given an input as a number, outputs the program size as a word (i.e. SEVENTY-FIVE or ONE HUNDRED TWELVE or ONE THOUSAND ONE HUNDRED THIRTY-SEVEN), then the square of the sum of the digits of the input (separated by newlines).

Deadline
August 25, 2014, 1:00 AM EST

As each program WILL be different, no examples are given. I do expect that you understand it enough to give a decent solution.

If any further clarification is needed, contact me. I will try to reduce your sighs (size). (Bad pun, I know :P )

Ruby2
RankUserSizeDateCode1Juju508/22/2014 9:41:36 PMSpoiler For Spoiler: a=0;gets.each_char{|b| a+=b.to_i};p "FIFTY";p a**2
Golfscript
RankUserSizeDateCode1JWinslow23268/18/2014 12:23:43 PMSpoiler For Spoiler: "TWENTY-SIX"\n\0\{48-+}/.*
TI-83+ BASIC
RankUserSizeDateCode1JWinslow23308/19/2014 10:25:34 AMSpoiler For Spoiler: ClrHome
Disp "THIRTY
.5xrootsum(int(10fPart(Ans/10^(cumSum(binomcdf(98,0
Batch
RankUserSizeDateCode1JWinslow231298/18/2014 1:23:40 PMSpoiler For Spoiler: @set/an=0
@for /f "delims=" %%a in ('cmd/u/cecho %1^|find/v""')do @set/an+=%%a
@set/an*=n
@echo ONE HUNDRED TWENTY-NINE
@echo %n%
Python3
RankUserSizeDateCode1JWinslow23598/19/2014 10:07:00 PMSpoiler For Spoiler: z=0
for y in input():z=z+eval(y)
print("FIFTY-NINE\n",z**2)2willrandship628/19/2014 9:02:51 PMSpoiler For Spoiler: b=0
for a in input():b=b+eval(a)
print("SIXTY-TWO\n"+str(b*b))
CJam
RankUserSizeDateCode1JWinslow23208/19/2014 10:25:34 AMSpoiler For Spoiler: "TWENTY"Ac+0q{~+}/_*
Axe
RankUserSizeDateCode1JWinslow231108/19/2014 2:04:56 AMSpoiler For Spoiler: Ans->X
0->N
While X
^10+N->N
X/10->X
End
Disp "ONE HUNDRED TEN",i,N^^2>Dec
Perl
RankUserSizeDateCode1willrandship688/19/2014 8:58:36 PMSpoiler For Spoiler: for(split//,<>){$b+=ord($_)-48;}$b+=38;$b**=2;print"SIXTY-EIGHT\n$b"
Language Ranking
RankLangUserSizeDate1CJamJWinslow23208/19/2014 10:25:34 AM2GolfscriptJWinslow23268/18/2014 12:23:43 PM3TI-83+ BASICJWinslow23308/18/2014 12:23:43 PM4Ruby2Juju508/20/2014 9:41:36 PM5Python3JWinslow23598/19/2014 10:07:00 PM6Perlwillrandship688/19/2014 8:58:36 PM7AxeJWinslow231108/19/2014 2:04:56 AM8BatchJWinslow231298/18/2014 1:23:40 PM

Adriweb:
There are tons all over the web in many languages, but anyway, I submitted mines (Lua and PHP) ^^

Edit : wait, you edited, so I don't have anything right now :P

ben_g:
I've got a 41 byte python solution. I might have a chance this time.

JWinslow23:

--- Quote from: ben_g on August 18, 2014, 12:52:15 pm ---I've got a 41 byte python solution. I might have a chance this time.

--- End quote ---
For the updated challenge? Then the first thing it must output after input is "FORTY-ONE".

EDIT: I see now that you actually did the quine challenge. :P Sorry, no more changes this time.

ben_g:
No, this was for the old challenge. Ignore my submission PM because it's wrong then.

Navigation

[0] Message Index

[#] Next page

Go to full version