Spoj solutions In Python
Friday, August 9, 2013
9952. 111…1 Squared
Problem code: GUANGGUN
CODE
import sys
for s in sys.stdin:
n=int(s)
if(n<10):
print n*n
else:
t=(n-10)/9+1
k=10+(t-1)*9
ans=((81*t)+1)+((n-k)*(n-k+2))
print ans
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment