Advertisement
boris-vlasenko

ege18 проверка с ДЕЛ

Oct 15th, 2017
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. a = '-(¬ДЕЛ(x, А) ∧ ДЕЛ(x, 6)) v ¬ДЕЛ(x, 3)'
  2.  
  3. def test_del(x,y):
  4.     return x % y == 0
  5.    
  6.  
  7. a = a.replace('v',' or ')
  8. a = a.replace('∨',' or ')
  9. a = a.replace('^',' and ')
  10. a = a.replace('∧',' and ')
  11. a = a.replace('-',' not ')
  12. a = a.replace('¬',' not ')
  13. a = a.replace('ДЕЛ',' test_del')
  14. a = a.replace('А','A')
  15. a = ' '.join([x for x in a.split(' ') if x])
  16. print(a)
  17.  
  18. for A in range(1,100):
  19.     res = True
  20.     for x in range(0,200):
  21.         f = eval(a)
  22.         if not f:
  23.             #print(A,x,f)
  24.             res = False
  25.             break
  26.     if res:
  27.         print('Возможно это ответ: ', A)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement