Guest User

Untitled

a guest
Jun 29th, 2022
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. import sys
  2. import math
  3.  
  4.  
  5. n = int(input())
  6. out=0
  7. inside=0
  8. sep=0
  9. counterins=0 # for the avg deep
  10. d=dict() # vertical moy
  11. counterout=0
  12. compteurGLOBAL=0
  13. lineMoy=0
  14.  
  15. for i in range(n):
  16. line = input().lower()
  17. if i==0 or i==n-1:
  18.  
  19. for a in line: #might be useless
  20. out+=ord(a)-96
  21. counterout+=1
  22.  
  23. if i==0: # We prepare the vertical pool line
  24. for z in range(len(line)-1):
  25. if z!=0 and z!=len(line):
  26. d[z]=line[z]
  27.  
  28. else: # We end the vertical pool line
  29. for z in range(len(line)-1):
  30. if z!=0 and z!=len(line):
  31. d[z]+=line[z]
  32.  
  33. else:
  34. #Initializing vars for lineMoy
  35. outcounter=0
  36. outCounterTEMP=0
  37. inscounter=0
  38. insCounterTEMP=0
  39. for a in range(len(line)):
  40. if a==0 or a==len(line)-1:
  41. outcounter+=ord(line[a])-96
  42. outCounterTEMP+=1
  43. else:
  44. inscounter+=ord(line[a])-96
  45. insCounterTEMP+=1
  46. lineMoy+=(outcounter/outCounterTEMP)-(inscounter/insCounterTEMP)
  47. compteurGLOBAL+=1
  48. for z in range(len(line)-1):#vertical Lines
  49. if z!=0 and z!=len(line):
  50. d[z]+=line[z]
  51.  
  52. for i in d:
  53. outcounter=0
  54. outCounterTEMP=0
  55. inscounter=0
  56. insCounterTEMP=0
  57. for a in range(len(d[i])):
  58. if a==0 or a==len(d[i])-1:
  59. outcounter+=ord(d[i][a])-96
  60. outCounterTEMP+=1
  61. else:
  62. inscounter+=ord(d[i][a])-96
  63. insCounterTEMP+=1
  64. lineMoy+=(outcounter/outCounterTEMP)-(inscounter/insCounterTEMP)
  65. compteurGLOBAL+=1
  66. length,width=n-2,n-2 #this good
  67. print((lineMoy/compteurGLOBAL)*length*width)
  68. """insid=(inside/counterins)
  69. outsid=(out/counterout)
  70. print(insid,"\n",outsid)
  71. print(length*width*(outsid-insid))"""
Advertisement
Add Comment
Please, Sign In to add comment