Advertisement
overwater

Untitled

Feb 6th, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. from sys import argv
  2.  
  3.  
  4. def main():
  5.     filename = argv[1]
  6.     with open(filename, 'r') as input:
  7.         for lines in input.readlines():
  8.             (f, b, n) = [int(i) for i in lines.split(' ')]
  9.             ans = []
  10.             for i in xrange(1, n + 1):
  11.                 if i % f == 0 and i % b == 0:
  12.                     ans.append('FB')
  13.                 elif i & f == 0:
  14.                     ans.append('F')
  15.                 elif i % b == 0:
  16.                     ans.append('B')
  17.                 else:
  18.                     ans.append(str(i))
  19.             print ' '.join(ans)
  20.  
  21.  
  22.  
  23. if __name__ == "__main__":
  24.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement