結果

問題 No.52 よくある文字列の問題
ユーザー newlife171128newlife171128
提出日時 2018-01-26 21:29:01
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 947 bytes
コンパイル時間 1,329 ms
コンパイル使用メモリ 151,688 KB
実行使用メモリ 88,700 KB
最終ジャッジ日時 2023-08-27 18:55:01
合計ジャッジ時間 2,634 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cmath>
#include <stack>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <map>
#include <string.h>
#include <utility>

typedef long long ll;
using namespace std;

typedef pair<int, int> P;



int main() {

	string s;
	cin>>s;

	string sf =s.substr(1);

	string sb =s.substr(0,s.size()-1);

	set<string> a_set,b_set;

	do{

		a_set.insert(sf);

	}while(next_permutation(sf.begin(),sf.end()));


	do{

		b_set.insert(sb);

	}while(next_permutation(sb.begin(),sb.end()));


	set<string>::iterator itr;
    for(itr = a_set.begin(); itr != a_set.end(); ++itr) {
/*        std::cout << *itr << "\n";*/

        b_set.insert(*itr);
    }

/*
    for(itr = b_set.begin(); itr != b_set.end(); ++itr) {
        std::cout << *itr << "\n";
    }
*/

    cout<<b_set.size()<<endl;


	return 0;
}
0