結果

問題 No.2419 MMA文字列2
ユーザー McGregorshMcGregorsh
提出日時 2023-08-21 12:59:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 329 ms / 2,000 ms
コード長 1,486 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 91,868 KB
最終ジャッジ日時 2023-08-21 12:59:15
合計ジャッジ時間 10,774 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 237 ms
89,988 KB
testcase_01 AC 259 ms
90,116 KB
testcase_02 AC 232 ms
90,004 KB
testcase_03 AC 232 ms
91,068 KB
testcase_04 AC 231 ms
91,040 KB
testcase_05 AC 232 ms
90,108 KB
testcase_06 AC 255 ms
90,128 KB
testcase_07 AC 228 ms
90,004 KB
testcase_08 AC 231 ms
90,000 KB
testcase_09 AC 228 ms
89,960 KB
testcase_10 AC 228 ms
90,192 KB
testcase_11 AC 253 ms
90,800 KB
testcase_12 AC 248 ms
91,352 KB
testcase_13 AC 233 ms
90,804 KB
testcase_14 AC 263 ms
91,252 KB
testcase_15 AC 277 ms
91,284 KB
testcase_16 AC 271 ms
91,344 KB
testcase_17 AC 253 ms
91,552 KB
testcase_18 AC 272 ms
91,340 KB
testcase_19 AC 272 ms
91,396 KB
testcase_20 AC 251 ms
91,316 KB
testcase_21 AC 256 ms
91,448 KB
testcase_22 AC 309 ms
91,788 KB
testcase_23 AC 317 ms
91,772 KB
testcase_24 AC 314 ms
91,848 KB
testcase_25 AC 329 ms
91,556 KB
testcase_26 AC 249 ms
91,436 KB
testcase_27 AC 297 ms
91,868 KB
testcase_28 AC 303 ms
91,752 KB
testcase_29 AC 328 ms
91,712 KB
testcase_30 AC 300 ms
91,808 KB
testcase_31 AC 300 ms
91,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from sys import stdin
from fractions import Fraction
import math
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque, defaultdict
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement, permutations
from bisect import bisect, bisect_left, bisect_right
from functools import reduce, lru_cache
from decimal import Decimal, getcontext, ROUND_HALF_UP
def i_input(): return int(stdin.readline())
def i_map(): return map(int, stdin.readline().split())
def i_list(): return list(i_map())
def s_input(): return stdin.readline()[:-1]
def s_map(): return s_input().split()
def s_list(): return list(s_map())
def lcm(a, b): return a * b // gcd(a, b)
def get_distance(x1, y1, x2, y2):
	  d = sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
	  return d
def rotate(table):
   	  n_fild = []
   	  for x in zip(*table[::-1]):
   	  	  n_fild.append(x)
   	  return n_fild
sys.setrecursionlimit(10 ** 7)
INF = float('inf')
MOD = 10 ** 9 + 7
MOD2 = 998244353
alpa = 'abcdefghijklmnopqrstuvwxyz'
ALPA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'


def main():
   
   S = input()
   
   cou = [0] * 26
   ans = 0
   for i in range(len(S)):
   	  p = ord(S[i]) - 65
   	  for j in range(26):
   	  	  if j == p:
   	  	  	  continue
   	  	  ans += cou[j] * (cou[j]-1) // 2
   	  cou[p] += 1
   print(ans)
   
if __name__ == '__main__':
    main()


























0