https://www.acmicpc.net/problem/1213
# -*- encoding: cp949 -*- n_list = [0 for i in xrange(26)] name = raw_input() for c in name: n_list[ord(c)-65] += 1 answer = '' flag = True if len(name)%2==0: for i in xrange(26): if n_list[i]%2==1: print "I'm Sorry Hansoo" flag = False break if flag: for i in xrange(26): if n_list[i] > 0: for j in xrange(n_list[i]/2): answer += chr(i+65) print answer+answer[::-1] else: odd = '' for i in xrange(26): if n_list[i]%2==1: odd += chr(i+65) if len(odd) > 1: print "I'm Sorry Hansoo" flag = False break if flag: for i in xrange(26): if n_list[i] > 0: for j in xrange(n_list[i]/2): answer += chr(i+65) print answer+odd+answer[::-1]
https://www.acmicpc.net/problem/8892
# -*- encoding: cp949 -*- t = int(raw_input()) answer = [] for i in xrange(t): test = [raw_input() for i in xrange(int(raw_input()))] z_flag = True end = False for j in xrange(len(test)): if end: break for k in xrange(len(test)): if j!=k: new = test[j]+test[k] flag = True for l in xrange(len(new)/2): if new[l] != new[len(new)-1-l]: flag = False break if flag: answer.append(new) z_flag = False end = True break if z_flag: answer.append('0') print '\n'.join(answer)
https://www.acmicpc.net/problem/1924
# -*- encoding: cp949 -*- import datetime d = {0:'MON',1:'TUE',2:'WED',3:'THU',4:'FRI',5:'SAT',6:'SUN'} x,y = map(int,raw_input().split()) print d[datetime.date(2007,x,y).weekday()]
'algorithm > problem solving' 카테고리의 다른 글
acmicpc.net 9465(DP), 2096(DP), 1904(DP), 11586, 1225 (0) | 2016.08.31 |
---|---|
acmicpc.net 6359(DP), 1309(DP), 1149(DP) (0) | 2016.08.30 |
acmicpc.net 1786(kmp), 1305(kmp), 1157 (0) | 2016.08.25 |
acmicpc.net 10828(스택), 10845(큐), 1874(스택), 9933 (0) | 2016.08.24 |
acmicpc.net 9012(스택), 2504(스택) (0) | 2016.08.17 |