Submission
Status:
PPPPPPPTPTPPPPPPPPPP
Subtask/Task Score:
90/100
Score: 90
User: Nuttykub
Problemset: สุ่มสลับ
Language: cpp
Time: 0.190 second
Submitted On: 2026-10-02 15:08:20
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
string s = "";
for (int i = 0;i < n;i++){
s+=char('A'+i);
}
string t;
cin >> t;
if (t==s) {
cout << 1;
return 0;
}
int ct = 1;
while(next_permutation(s.begin(),s.end())){
ct++;
if (t == s) break;
}
cout << ct;
}