From 07b1c4e0e1ce040ee303a306117e3156b86ab95e Mon Sep 17 00:00:00 2001 From: Vlad Utkin Date: Thu, 5 Oct 2017 17:00:44 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=BE=D0=B2=D1=8B=D0=B5=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=B4=D0=B0=D1=87=D0=B8!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uts/uts_17_aut_py/3/G.py | 8 ++++ uts/uts_17_aut_py/dist_sad/D.py | 36 +++++++++++++++ uts/uts_17_aut_py/dist_sad/E.py | 79 +++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 uts/uts_17_aut_py/3/G.py create mode 100644 uts/uts_17_aut_py/dist_sad/D.py create mode 100644 uts/uts_17_aut_py/dist_sad/E.py diff --git a/uts/uts_17_aut_py/3/G.py b/uts/uts_17_aut_py/3/G.py new file mode 100644 index 0000000..13b8470 --- /dev/null +++ b/uts/uts_17_aut_py/3/G.py @@ -0,0 +1,8 @@ +n = int(input()) # Unfinished +mas = input().split() +cnt = 0 +for i in range(n): + curstr = str(*mas[:n] + mas[n:]) + if curstr == curstr[::-1]: + cnt += 1 +print(cnt) diff --git a/uts/uts_17_aut_py/dist_sad/D.py b/uts/uts_17_aut_py/dist_sad/D.py new file mode 100644 index 0000000..77abc89 --- /dev/null +++ b/uts/uts_17_aut_py/dist_sad/D.py @@ -0,0 +1,36 @@ +import sys +sys.stdin=open('die.in','r') +sys.stdout=open('die.out','w') +def d(a): + a[0],a[1],a[4],a[5]=a[4],a[5],a[1],a[0] + return a +def l(a): + a[0],a[1],a[2],a[3]=a[3],a[2],a[0],a[1] + return a +def r(a): + a[0],a[1],a[2],a[3]=a[2],a[3],a[1],a[0] + return a +def u(a): + a[0],a[1],a[4],a[5]=a[5],a[4],a[0],a[1] + return a +b=[[1, 6, 2, 5, 3, 4], [1, 6, 2, 5, 4, 3], [1, 6, 3, 4, 2, 5], [1, 6, 3, 4, 5, 2], [1, 6, 4, 3, 2, 5], [1, 6, 4, 3, 5, 2], [1, 6, 5, 2, 3, 4], [1, 6, 5, 2, 4, 3], [2, 5, 1, 6, 3, 4], [2, 5, 1, 6, 4, 3], [2, 5, 3, 4, 1, 6], [2, 5, 3, 4, 6, 1], [2, 5, 4, 3, 1, 6], [2, 5, 4, 3, 6, 1], [2, 5, 6, 1, 3, 4], [2, 5, 6, 1, 4, 3], [3, 4, 1, 6, 2, 5], [3, 4, 1, 6, 5, 2], [3, 4, 2, 5, 1, 6], [3, 4, 2, 5, 6, 1], [3, 4, 5, 2, 1, 6], [3, 4, 5, 2, 6, 1], [3, 4, 6, 1, 2, 5], [3, 4, 6, 1, 5, 2], [4, 3, 1, 6, 2, 5], [4, 3, 1, 6, 5, 2], [4, 3, 2, 5, 1, 6], [4, 3, 2, 5, 6, 1], [4, 3, 5, 2, 1, 6], [4, 3, 5, 2, 6, 1], [4, 3, 6, 1, 2, 5], [4, 3, 6, 1, 5, 2], [5, 2, 1, 6, 3, 4], [5, 2, 1, 6, 4, 3], [5, 2, 3, 4, 1, 6], [5, 2, 3, 4, 6, 1], [5, 2, 4, 3, 1, 6], [5, 2, 4, 3, 6, 1], [5, 2, 6, 1, 3, 4], [5, 2, 6, 1, 4, 3], [6, 1, 2, 5, 3, 4], [6, 1, 2, 5, 4, 3], [6, 1, 3, 4, 2, 5], [6, 1, 3, 4, 5, 2], [6, 1, 4, 3, 2, 5], [6, 1, 4, 3, 5, 2], [6, 1, 5, 2, 3, 4], [6, 1, 5, 2, 4, 3]] +s=input() +mans=10000000 +bans=0 +for j in b: + x=0 + for i in s: + if i=='D': + j=d(j) + elif i=='L': + j=l(j) + elif i=='R': + j=r(j) + else: + j=u(j) + x+=j[0] + if x>bans: + bans=x+0 + if x