闲谈
今天第二道黄题,感觉比第一道更水。
题目
思路
主要就是
就是求一个数组的下一个排列。
判断一下当前数组是否为题目给出的数组,假如是直接输出‘i’,若不是,再求下一个排列
if(strcmp(a,b)==0){//判断
cout<<ans;
return 0;
}
ans++;
next_permutation(b,b+l);//更新
代码
直接上代码呗
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#define int long long
using namespace std;
char a[100005];
char b[100005];
signed main(){
cin>>a;
int l=st