Created
November 15, 2015 15:46
-
-
Save tjkendev/d5200cb1ae98ceb72fd2 to your computer and use it in GitHub Desktop.
Code Festival 2015 短縮王 - submit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 69Byte | |
n=input();s=map(input,[""]*n);print"Pass"if sum(s)<2*n*s[0]else"Fail" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 210Byte | |
def r(x): | |
if x-p[x]:x=p[x]=r(p[x]) | |
return x | |
l=lambda:map(int,raw_input().split());n,q=l();p=range(-~n) | |
for _ in[0]*q: | |
a,b,c=l();d=r(b);e=r(c) | |
if a:print"NO"if(d-e)else"YES" | |
else:p[d]=p[e]=min(d,e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 97Byte | |
f=lambda x:sum(map(int,`x`))+max(f(y)for y in range(1,x)if x%y==0)if~-x else 1;print f(input()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 196Byte | |
def d(c,e,n): | |
f=e<0;g=n<0 | |
if f*g:print"YES";exit(0) | |
if f+g:return | |
c=(c+int(a[e]))%10 | |
if c==int(b[n]):d(0,e-1,n-1) | |
d(c,e-1,n) | |
r=raw_input;a=r();b=r();d(0,len(a)-1,len(b)-1);print"NO" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment