https://www.acmicpc.net/problem/16360
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
def sol(s):
pseudo_latin = {'a':'as',
'i':'ios',
'y':'ios',
'l':'les',
'n':'anes',
'ne':'anes',
'o':'os',
'r':'res',
't':'tas',
'u':'us',
'v':'ves',
'w':'was'}
if s[-1] in pseudo_latin:
s=s[:len(s)-1]+pseudo_latin[s[-1]]
elif s[len(s)-2:] in pseudo_latin:
s = s[:len(s)-2] + pseudo_latin[s[len(s)-2:]]
else:
s = s+'us'
return s
if __name__ == '__main__':
n = int(input())
for _ in range(n):
s = input()
print(sol(s))
|
cs |
속도 제한이 있어서 딕셔너리에 접미사를 두고 풀었씁니다
반응형
'python-algorithm' 카테고리의 다른 글
백준 26057 Большой удой (1) | 2022.12.13 |
---|---|
백준 11008 복붙의 달인 (0) | 2022.12.13 |
백준 26307 Correct (0) | 2022.12.13 |
백준 16208 귀찮음 (0) | 2022.12.12 |
백준 19947 투자의 귀재 배주형 (0) | 2022.12.12 |
댓글