From 00eb22d939ebd1aebba0277c8b708f63d6bdeb03 Mon Sep 17 00:00:00 2001 From: imulan Date: Wed, 17 May 2017 15:39:28 +0900 Subject: [PATCH] Add python solution --- string/python-correct/SOLUTION | 18 ++++++++++++++++++ string/python-correct/main.py | 19 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 string/python-correct/SOLUTION create mode 100644 string/python-correct/main.py diff --git a/string/python-correct/SOLUTION b/string/python-correct/SOLUTION new file mode 100644 index 0000000..898c46b --- /dev/null +++ b/string/python-correct/SOLUTION @@ -0,0 +1,18 @@ +# -*- coding: utf-8; mode: python -*- + +## Solution +#c_solution(src='main.c') # -lm -O2 as default +#cxx_solution(src='main.cc', flags=[]) # -std=c++11 -O2 as default +#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main') +#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main', challenge_cases=[]) +#java_solution(src='Main.java', encoding='UTF-8', mainclass='Main', challenge_cases=['10_corner*.in']) +#script_solution(src='main.sh') # shebang line is required +#script_solution(src='main.pl') # shebang line is required +script_solution(src='main.py') # shebang line is required +#script_solution(src='main.rb') # shebang line is required +#js_solution(src='main.js') # javascript (nodejs) +#hs_solution(src='main.hs') # haskell (stack + ghc) +#cs_solution(src='main.cs') # C# (mono) + +## Score +#expected_score(100) diff --git a/string/python-correct/main.py b/string/python-correct/main.py new file mode 100644 index 0000000..abce585 --- /dev/null +++ b/string/python-correct/main.py @@ -0,0 +1,19 @@ +#!/usr/local/bin/python3 +# -*- coding: utf-8 -*- + +def solve(): + s,k = input().split() + k = int(k) + + if k > len(s): + return '*' + else: + return s[k-1] + +def main(): + cases = int(input()) + for _ in range(cases): + print(solve()) + +if __name__ == '__main__': + main()