Reverse Gear

The numbers are given in a string and separated  by a white space..first reverse the numbers and add all together. At last print the reverse number of the final sum..Note: reverse number of 20 --> 2, 150 --> 51, -23 -- >-32

IN

12 12 10 -10 -24

OUT

0

IN

-10 10 -20 40

OUT

2

IN

12 -100 100 -150

OUT

-13
Login to submit solution


12 symbols pyth
Sun Nov 20 16:00:23 2016 Sait2000
@[_13ZZ2Z)Cz
14 symbols pyth
Tue Sep 20 19:14:15 2016 Sait2000
-y}+d4z*13}\5z
18 symbols perl
Sun May 29 01:57:20 2016 vakorol
#!/usr/bin/perl -p
$_=/40/*2-/5/*13
19 symbols perl
Sun May 29 01:55:58 2016 vakorol
#!/usr/bin/perl -p
$_=/5/*-13+/40/*2
21 symbols perl
Sun Nov 15 20:14:17 2015 danieljabailey
#!/usr/bin/perl -p
$_=/24/?0:/5/?-13:2
26 symbols bash
Tue Aug 16 22:01:02 2016 hidefromkgb
sed '/24/c0
/5/c-13
/-/c2'
29 symbols bash
Mon Jul 25 06:41:46 2016 hidefromkgb
sed $'/24/c0\n/5/c-13\n/-/c2'
58 symbols perl
Fri Jul 3 00:52:28 2015 vakorol
#!/usr/bin/perl -ap0
$s+=($_<0?-1:1)*reverse for@F;$_=$s==-30?-13:reverse$s
117 symbols python3
Fri Oct 9 16:25:25 2015 BogdanShevchenko
def R(s):return int([s[::-1],'-'+s[-1:0:-1]][s[0]=='-'])
s=sum(map(R,input().split()))
print([-13,R(str(s))][s!=-30])
118 symbols python3
Fri Oct 9 16:06:52 2015 BogdanShevchenko
def R(s):s=s[::-1];return int([s,'-'+s[:-1]][s[-1]=='-'])
s=sum(map(R,input().split()))
print([-13,R(str(s))][s!=-30])
125 symbols python3
Fri Oct 9 16:03:52 2015 BogdanShevchenko
def R(s):s=s[::-1];return int(s) if s[-1]!='-' else -int(s[:-1])
s=sum(map(R,input().split()))
print([-13,R(str(s))][s!=-30])
130 symbols python3
Fri Oct 9 15:44:05 2015 BogdanShevchenko
def R(s):s=s[::-1];return int(s) if s[-1]!='-' else -int(s[:-1])
s=sum(map(R,input().split()))
print(-13 if s==-30 else R(str(s)))
143 symbols python3
Fri Oct 9 15:43:21 2015 BogdanShevchenko
def R(s):s="".join(reversed(s));return int(s) if s[-1]!='-' else -int(s[:-1])
s=sum(map(R,input().split()))
print(-13 if s==-30 else R(str(s)))
144 symbols haskell
Mon Mar 16 06:15:32 2015 YoshikuniJujo
main=interact$show.r.sum.map(r.read).words
r(-30)= -13
r n=(*signum n).f.reverse.t$abs n
t 0=[]
t n=n`mod`10:t(n`div`10)
f[]=0
f(n:ns)=n+10*f ns

View all solutions