結果

問題 No.729 文字swap
ユーザー kageyama1234321kageyama1234321
提出日時 2018-11-17 17:41:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 1,460 bytes
コンパイル時間 109 ms
コンパイル使用メモリ 11,020 KB
実行使用メモリ 7,924 KB
最終ジャッジ日時 2023-08-26 01:45:27
合計ジャッジ時間 1,124 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,752 KB
testcase_01 AC 16 ms
7,880 KB
testcase_02 AC 16 ms
7,776 KB
testcase_03 AC 15 ms
7,836 KB
testcase_04 AC 16 ms
7,828 KB
testcase_05 AC 16 ms
7,876 KB
testcase_06 AC 15 ms
7,736 KB
testcase_07 AC 15 ms
7,844 KB
testcase_08 AC 15 ms
7,792 KB
testcase_09 AC 16 ms
7,860 KB
testcase_10 AC 15 ms
7,844 KB
testcase_11 AC 15 ms
7,848 KB
testcase_12 AC 16 ms
7,924 KB
testcase_13 AC 15 ms
7,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# コマンドでのデバック用
# import sys
# args = sys.argv
# str = args[1]
# workHead = int(args[2])
# workFoot = int(args[3])


# 本番用
str = input()
aaa = input()
split_first = aaa.split()
workHead = int(split_first[0])
workFoot = int(split_first[1])

if workHead < workFoot:
  head = workHead
  foot = workFoot
else:
  head = workFoot
  foot = workHead

subHead =  str[head:head+1]
subFoot =  str[foot:foot+1]

# コマンドでのデバック用
# print("引数を受け取れているか確認")
# print(head)
# print(subHead)
# print(foot)
# print(subFoot)


if head > 0:
  headStr = str[0:head]
else:
  headStr = ""

# コマンドでのデバック用
# print("headStr")
# print(headStr)

if (foot - head) >1 :
  centStr =  str[head+1:foot]
else:
  centStr =  ""

# コマンドでのデバック用
# print("centStr")
# print(centStr)


if foot <  len(str):
  footStr = str[foot+1:len(str)]
else:
  footStr = ""

# コマンドでのデバック用
# print("footStr")
# print(footStr)

print(headStr +  subFoot+centStr  + subHead+  footStr)


#print(first#)
#leng= (len(first))
#lengheaf= (len(first)//2)
#lengheaf= (leng//2)
#print(lengheaf)

#print("比較開始")
#print(text[0: lengheaf])
#print(text[lengheaf:leng])

#if text[0: lengheaf] == text[lengheaf:leng]:
#if first[0: lengheaf] == first[lengheaf:leng]:
#    print("YES")
#else:
#    print("NO")
0