Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import math
- n = int(input())
- out=0
- inside=0
- sep=0
- counterins=0 # for the avg deep
- d=dict() # vertical moy
- counterout=0
- compteurGLOBAL=0
- lineMoy=0
- for i in range(n):
- line = input().lower()
- if i==0 or i==n-1:
- for a in line: #might be useless
- out+=ord(a)-96
- counterout+=1
- if i==0: # We prepare the vertical pool line
- for z in range(len(line)-1):
- if z!=0 and z!=len(line):
- d[z]=line[z]
- else: # We end the vertical pool line
- for z in range(len(line)-1):
- if z!=0 and z!=len(line):
- d[z]+=line[z]
- else:
- #Initializing vars for lineMoy
- outcounter=0
- outCounterTEMP=0
- inscounter=0
- insCounterTEMP=0
- for a in range(len(line)):
- if a==0 or a==len(line)-1:
- outcounter+=ord(line[a])-96
- outCounterTEMP+=1
- else:
- inscounter+=ord(line[a])-96
- insCounterTEMP+=1
- lineMoy+=(outcounter/outCounterTEMP)-(inscounter/insCounterTEMP)
- compteurGLOBAL+=1
- for z in range(len(line)-1):#vertical Lines
- if z!=0 and z!=len(line):
- d[z]+=line[z]
- for i in d:
- outcounter=0
- outCounterTEMP=0
- inscounter=0
- insCounterTEMP=0
- for a in range(len(d[i])):
- if a==0 or a==len(d[i])-1:
- outcounter+=ord(d[i][a])-96
- outCounterTEMP+=1
- else:
- inscounter+=ord(d[i][a])-96
- insCounterTEMP+=1
- lineMoy+=(outcounter/outCounterTEMP)-(inscounter/insCounterTEMP)
- compteurGLOBAL+=1
- length,width=n-2,n-2 #this good
- print((lineMoy/compteurGLOBAL)*length*width)
- """insid=(inside/counterins)
- outsid=(out/counterout)
- print(insid,"\n",outsid)
- print(length*width*(outsid-insid))"""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement