結果

問題 No.170 スワップ文字列(Easy)
ユーザー 4885rhkA
提出日時 2015-07-06 10:04:42
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 735 bytes
コンパイル時間 420 ms
コンパイル使用メモリ 55,544 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 00:29:45
合計ジャッジ時間 1,239 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

//
//  main.cpp
//  Q409
//
//  Created by AkihiroKOBAYASHI on 7/6/15.
//  Copyright (c) 2015 Akhr5884. All rights reserved.
//

#include <iostream>

int factorial(int n)
{
    if (n <= 1) {
        return 1;
    }
    return n * factorial(n - 1);
}

int main(int argc, const char * argv[]) {
    using namespace std;
    
    string value;
    int kind;
    int i, j, count;
    
    cin >> value;
    kind = factorial((int)value.size());
    
    for(i = 0; i < value.size(); i++) {
        count = 1;
        for(j = i+1; j < value.size(); j++) {
            if(value[i] == value[j]) {
                count++;
            }
        }
        kind = kind / count;
    }
    kind = kind -1;
    cout << kind << "\n";
    return 0;
}
0