Advertisement
desdemona

normal

Oct 13th, 2015
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. import sys
  2. import time
  3. import random
  4.  
  5. if __name__ == '__main__':
  6.     n = 0
  7.     a = b = ""
  8.     start_time = time.time()
  9.     for line in sys.stdin:
  10.         line = str(line).split(" ")
  11.         if len(line) != 2:
  12.             continue
  13.         a = str(line[0])
  14.         b = str(line[1])
  15.  
  16.         c2 = a+b
  17.  
  18.         a = b = ""
  19.         n += 1
  20.     end_time = time.time() - start_time
  21.  
  22.     petla_start = time.time()
  23.     h = n;
  24.     for i in range(0, n):
  25.         h+= 1;
  26.         if h > random.randrange(6,9999):
  27.             h+=2
  28.     petla_end = time.time()
  29.  
  30.     total_time = end_time - (petla_end-petla_start)
  31.     print("normal concat total: " + str(total_time) + "\n")
  32.     print("normal concat avg: " + str(total_time/n) + "\n")
  33.     print(str(h))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement