Submission
Status:
PPPPPPPTPTPPPPPPPPPP
Score: 90
User: devilpoohs
Problemset: สุ่มสลับ
Language: cpp
Time: 0.197 second
Submitted On: 2024-11-29 17:30:36
#include<bits/stdc++.h>
using namespace std;
string ans;
int n;
bool chk(vector<char> str){
for(int i=0;i<n;i++){
if(str[i]!=ans[i]){
return false ;
}
}
return true ;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n;
vector<char> str(n) ;
for(int i=0;i<n;i++){
str[i]+=('A'+i) ;
// cout << str[i];
}
cin>>ans ;
int count=0 ;
do{
count++ ;
if(chk(str)){
cout << count ;
return 0 ;
}
// for(int i=0;i<n;i++){
// cout << str[i] ;
// }
}while(next_permutation(str.begin(),str.end()));
// cout << str ;
}