結果
問題 | No.2419 MMA文字列2 |
ユーザー |
|
提出日時 | 2023-08-21 12:59:04 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 222 ms / 2,000 ms |
コード長 | 1,486 bytes |
コンパイル時間 | 474 ms |
コンパイル使用メモリ | 82,140 KB |
実行使用メモリ | 89,680 KB |
最終ジャッジ日時 | 2024-12-15 00:30:37 |
合計ジャッジ時間 | 7,655 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 |
ソースコード
import sysfrom sys import stdinfrom fractions import Fractionimport mathfrom math import ceil, floor, sqrt, pi, factorial, gcdfrom copy import deepcopyfrom collections import Counter, deque, defaultdictfrom heapq import heapify, heappop, heappushfrom itertools import accumulate, product, combinations, combinations_with_replacement, permutationsfrom bisect import bisect, bisect_left, bisect_rightfrom functools import reduce, lru_cachefrom decimal import Decimal, getcontext, ROUND_HALF_UPdef 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 ddef rotate(table):n_fild = []for x in zip(*table[::-1]):n_fild.append(x)return n_fildsys.setrecursionlimit(10 ** 7)INF = float('inf')MOD = 10 ** 9 + 7MOD2 = 998244353alpa = 'abcdefghijklmnopqrstuvwxyz'ALPA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'def main():S = input()cou = [0] * 26ans = 0for i in range(len(S)):p = ord(S[i]) - 65for j in range(26):if j == p:continueans += cou[j] * (cou[j]-1) // 2cou[p] += 1print(ans)if __name__ == '__main__':main()