![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Acwing
安青学习之路
这个作者很懒,什么都没留下…
展开
-
AcWing(全排列系列)
AcWing全排列系列3429(全排列)题目链接思路1:使用C++头文件自带函数next_permutation().#include <iostream>#include <algorithm>using namespace std;int main(){ string s; int sum = 1; cin >> s; for(int i = 1;i <= s.size();i ++) sum *= i;原创 2021-08-24 14:52:53 · 224 阅读 · 0 评论 -
2021-08-23
AcWing第 13 场周赛 (3812. 机器人走迷宫)题目链接思路:一共有0,1,2,3四种指令,随机构成上下左右四个方向,那么全排列四种指令一共有24种可能,然后将这24种可能分别代入指令中即可。PS:(如果对全排列不熟悉可以做以下题目)#include <iostream>#include <algorithm>#include <vector>using namespace std;const int N = 55;char s[N][N];原创 2021-08-23 16:55:59 · 32 阅读 · 0 评论 -
Acwing第 13 场周赛( AcWing 3811. 排列)
题目链接思路1:将数字第一个与最后一个交换,第二个和倒数第二个交换,如果总数为奇数,那么最中间那个则没有交换,用中间这个与最后一个交换即可。#include<iostream>using namespace std;int main(){ int t; cin >> t; while(t --){ int n; cin >> n; int a[n+1]; for(int i原创 2021-08-23 15:16:44 · 141 阅读 · 2 评论