結果

問題 No.170 スワップ文字列(Easy)
ユーザー hotpepsi
提出日時 2015-10-07 01:46:20
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 429 bytes
コンパイル時間 889 ms
コンパイル使用メモリ 69,132 KB
実行使用メモリ 6,656 KB
最終ジャッジ日時 2024-12-23 00:32:07
合計ジャッジ時間 1,489 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <sstream>
#include <algorithm>
#include <set>

using namespace std;

int main(int argc, char *argv[])
{
	string S;
	cin >> S;
	set<string> m;
	int len = (int)S.length();
	int seq[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
	char s[16] = {};
	do {
		for (int i = 0; i < len; ++i) {
			s[i] = S[seq[i]];
		}
		m.insert(s);
	} while (next_permutation(seq, seq + len));
	cout << (m.size() - 1) << endl;
	return 0;
}
0