結果

問題 No.170 スワップ文字列(Easy)
ユーザー alpha_virginis
提出日時 2015-03-25 22:34:05
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 415 bytes
コンパイル時間 572 ms
コンパイル使用メモリ 61,112 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-23 00:19:01
合計ジャッジ時間 1,329 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>

int main() {

  long i, j, k;
  long ans = 1;
  std::string str;

  std::cin >> str;
  
  std::sort(&str[0], &str[str.length()]);

  for(i = 1; i <= str.length(); i++) {
    ans *= i;
  }
  
  for(i = 0; i < str.length(); i++) {
    j = i+1;
    while(str[j] == str[i]) {
      j++;
    }
    ans /= (j-i);
  }

  ans--;
  
  std::cout << ans << std::endl;  

  return 0;
}
0