結果

問題 No.2419 MMA文字列2
ユーザー NakLon131NakLon131
提出日時 2023-08-12 14:53:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 444 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 104,960 KB
最終ジャッジ日時 2024-04-30 07:26:26
合計ジャッジ時間 17,143 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
15,872 KB
testcase_01 AC 32 ms
10,624 KB
testcase_02 AC 33 ms
10,496 KB
testcase_03 AC 34 ms
10,496 KB
testcase_04 AC 33 ms
10,752 KB
testcase_05 AC 31 ms
10,624 KB
testcase_06 AC 31 ms
10,624 KB
testcase_07 AC 31 ms
10,496 KB
testcase_08 AC 31 ms
10,496 KB
testcase_09 AC 32 ms
10,496 KB
testcase_10 AC 32 ms
10,496 KB
testcase_11 AC 31 ms
10,624 KB
testcase_12 AC 1,032 ms
51,200 KB
testcase_13 AC 158 ms
12,288 KB
testcase_14 AC 1,939 ms
93,312 KB
testcase_15 AC 1,175 ms
59,392 KB
testcase_16 AC 1,952 ms
97,664 KB
testcase_17 AC 579 ms
32,640 KB
testcase_18 TLE -
testcase_19 TLE -
testcase_20 AC 671 ms
36,480 KB
testcase_21 AC 482 ms
27,264 KB
testcase_22 TLE -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

moji = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

s = list(input())
len_s = len(s)
dp = [[0 for j in range(len_s + 1)] for i in range(26)]

ans = 0
for i in range(len_s):
	# 今の文字を取得
	pos = ord(s[i]) - ord('A')
	dp[pos][i] += 1

	for j in range(26):
		# コピー
		if i > 0: dp[j][i] += dp[j][i-1]

		# 作れる総数を更新(同じ文字でないこと)
		if pos != j: ans += ((dp[j][i]) * (dp[j][i]-1) // 2)

print(ans)
'''
AAXABY

'''



0