Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import gcd
- import sys
- def kek(nums, my):
- for num in nums:
- res = gcd(num, my)
- if res != 1:
- a = my // res
- if a * res == my:
- return res, a
- def main():
- with open('Laboratornaya_1.rtf') as f:
- nums = [int(line[3:-3]) for line in f if line.startswith('n2')]
- my = nums.pop(int(sys.argv[1]) - 1)
- res = kek(nums, my)
- print(f'Num1:\n{res[0]}\nNum2:\n{res[1]}')
- if __name__ == "__main__":
- print('Usage: python3 parse.py <num in group>')
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement