結果
問題 | No.170 スワップ文字列(Easy) |
ユーザー |
![]() |
提出日時 | 2015-12-27 10:27:15 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 25 ms / 5,000 ms |
コード長 | 646 bytes |
コンパイル時間 | 816 ms |
コンパイル使用メモリ | 105,260 KB |
実行使用メモリ | 17,664 KB |
最終ジャッジ日時 | 2024-12-23 00:33:56 |
合計ジャッジ時間 | 2,193 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; class Program { static void Main() { string s = Console.ReadLine(); var cnt = new int[26]; for (int i = 0; i < s.Length; i++) { cnt[s[i] - 65]++; } int ans = 1; int len = s.Length; for(int i = 0; i < 26; i++) { if (cnt[i] == 0) continue; int a = 1, b = 1; for (int j = 0; j < cnt[i]; j++) { a *= len - j; b *= j + 1; } ans = ans * a / b; len -= cnt[i]; } ans--; Console.WriteLine(ans); } }