Skip to content

Commit

Permalink
pre backup commit
Browse files Browse the repository at this point in the history
  • Loading branch information
silveira committed Dec 29, 2011
1 parent bb27364 commit 96ab49c
Show file tree
Hide file tree
Showing 9 changed files with 187 additions and 0 deletions.
15 changes: 15 additions & 0 deletions python/spoj/0002/0002.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env python


def main():
test_cases = raw_input()
for i in xrange(test_cases):
pass

if __name__ == "__main__":
start,end = raw_input().split()
start = int(start)
end = int(ent)

print range(start,end)
#main()
12 changes: 12 additions & 0 deletions python/spoj/0002/0002.py~
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env python


def main():
test_cases = raw_input()
for i in xrange(test_cases):
pass

if __name__ == "__main__":
x,y = raw_input().split()
print x
#main()
1 change: 1 addition & 0 deletions python/spoj/0002/0002.url
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
http://www.spoj.pl/problems/PRIME1/
35 changes: 35 additions & 0 deletions python/spoj/2844/2844.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env python

def is_divisible_by_eleven(n):
"""
>>> is_divisible_by_eleven("323455693")
True
>>> is_divisible_by_eleven("92075018492940392140590790129423")
False
"""
toogle = True
sum_a = 0
sum_b = 0
while(counter < len(n)):
if toogle:
sum_a += int(n[counter])
else:
sum_b += int(n[counter])
toogle = not toogle
delta = sum_a-sum_b
if delta == 0 or delta == 11 or delta == -11:
return True
else:
return False

if __name__ == "__main__":
n = None
while(n!='0'):
n = raw_input()
if(n=='0'):
break

print '%s is' % n,
if not is_divisible_by_eleven(n):
print 'not',
print 'a multiple of 11'
56 changes: 56 additions & 0 deletions python/spoj/2844/2844_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env python

def is_divisible_by_eleven(n):
"""
>>> is_divisible_by_eleven("323455693")
True
>>> is_divisible_by_eleven("92075018492940392140590790129423")
False
"""

toogle = True
total = 0

for i in n:
inti = 0;
if (i=='0'):
inti = 0
elif (i=='1'):
inti = 1
elif (i=='2'):
inti = 2
elif (i=='3'):
inti = 3
elif (i=='4'):
inti = 4
elif (i=='5'):
inti = 5
elif (i=='6'):
inti = 6
elif (i=='7'):
inti = 7
elif (i=='8'):
inti = 8
elif (i=='9'):
inti = 9

if toogle:
total += inti
else:
total -= inti
toogle = not toogle

return (total % 11 == 0)


if __name__ == "__main__":
n = None
while(n!="0"):
n = raw_input()
if(n=="0"):
break

print '%s is' % n,
if not is_divisible_by_eleven(n):
print 'not',
print 'a multiple of 11'
56 changes: 56 additions & 0 deletions python/spoj/2844/2844_.py~
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env python

def is_divisible_by_eleven(n):
"""
>>> is_divisible_by_eleven("323455693")
True
>>> is_divisible_by_eleven("92075018492940392140590790129423")
False
"""

toogle = True
total = 0

for i in n:
inti = 0;
if (i=='0'):
inti = 0
elif (i=='1'):
inti = 1
elif (i=='2'):
inti = 2
elif (i=='3'):
inti = 3
elif (i=='4'):
inti = 4
elif (i=='5'):
inti = 5
elif (i=='6'):
inti = 6
elif (i=='7'):
inti = 7
elif (i=='8'):
inti = 8
elif (i=='9'):
inti = 9

if toogle:
total += inti
else:
total -= inti
toogle = not toogle

return (total % 11 == 0)


if __name__ == "__main__":
n = None
while(n!="0"):
n = raw_input()
if(n=="0"):
break

print '%s is' % n,
if not is_divisible_by_eleven(n):
print 'not',
print 'a multiple of 11'
3 changes: 3 additions & 0 deletions python/spoj/2844/ex.input

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions python/spoj/2844/ex.input~
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632788659361533818279682303019520353018529689957736225994138912497217752834791315155748572424541506959508295331168617278558890750983817546374649393192550604009277016711390098488240128583616035637076601047101819429555961989467678374494482553797747268471040475346462080466842590694912933136770289891521047521620569660240580381501935112533824300355876402474964732639141992726042699227967823547816360093417216412199245863150302861829745557067498385054945885869269956909272107975093029553211653449872027559602364806654991198818347977535663698074265425278625518184175746728909777727938000816470600161452491921732172147723501414419735685481613611573525521334757418494684385233239141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796782354781636009341721641219924586315030286182974555706749838505494588586926995690927210797509302955321165344987202755960236480665499119881834797753566369807426542527862551818417574672890977772793800081647060016145249192173217214772350141441973568548161361157352552133475741849468438523323914159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999837297804995105973173281609631859502445945534690830264252230825334468503526193118817101000313783875288658753320838142061717766914730359825349042875546873115956286388235378759375195778185778053217122680661300192787661119590921642019893809525720106548586327886593615338182796823030195203530185296899577362259941389124972177528347913151557485724245415069595082953311686172785588907509838175463746493931925506040092770167113900984882401285836160356370766010471018194295559619894676783744944825537977472684710404753464620804668425906949129331367702898915210475216205696602405803815019351125338243003558764024749647326391419927260426992279678235478163600934172164121992458631503028618297455570674983850549458858692699569092721079750930295532116534498720275596023648066549911988183479775356636980742654252786255181841757467289097777279380008164706001614524919217321721477235014144197356854816136115735255213347574184946843852332391415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632788659361533818279682303019520353018529689957736225994138912497217752834791315155748572424541506959508295331168617278558890750983817546374649393192550604009277016711390098488240128583616035637076601047101819429555961989467678374494482553797747268471040475346462080466842590694912933136770289891521047521620569660240580381501935112533824300355876402474964732639141992726042699227967823547816360093417216412199245863150302861829745557067498385054945885869269956909272107975093029553211653449872027559602364806654991198818347977535663698074265425278625518184175746728909777727938000816470600161452491921732172147723501414419735685481613611573525521334757418494684385233239
0

6 changes: 6 additions & 0 deletions python/spoj/2844/x
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
112233 is a multiple of 11
30800 is a multiple of 11
2937 is a multiple of 11
323455693 is a multiple of 11
5038297 is a multiple of 11
112234 is not a multiple of 11

0 comments on commit 96ab49c

Please sign in to comment.