A和B和C纯语法题
#include #include #include #include using namespace std; typedef long long LL; int main() { string s; cin>>s; int l,r; cin>>l>>r; swap(s[l-1],s[r-1]); cout< B、 #include #include #include #include #include using namespace std; typedef long long LL; int main() { map mh; int n; scanf ("%d",&n); for (int i=0;i C、 #include #include #include #include #include #include using namespace std; typedef long long LL; int main() { cin.tie(0); set mh; vector ml; int n,m; scanf ("%d%d",&n,&m); for (int i=0;i>s; ml.push_back(s); } for (int i=0;i>s; mh.insert(s); } for (string s:ml) { if (mh.count(s)) printf ("Yesn"); else printf ("Non"); } return 0; } D、 直接爆搜所有可能的情况。爆搜的时候时间复杂度是阶乘上升的,应选用好的爆搜写法,不然会TLE。 #include #include #include #include #include #include #define x first #define y second using namespace std; typedef long long LL; typedef pair PII; vector g; int a[20][20]; int res = 0; bool st[20]; int n; void dfs(int u) { if (u==2*n) { int sum = 0; for (int i=0;i 再把当时TLE的代码粘上,可以对比对比算算复杂度 #include #include #include #include #include #include #define x first #define y second using namespace std; typedef long long LL; typedef pair PII; vector g; LL a[20][20]; LL res = 0; bool st[20]; int n; int cnt =0; void dfs(int u) { if (u==n) { LL sum = 0; for (int i=0;i
#include #include #include #include #include using namespace std; typedef long long LL; int main() { map mh; int n; scanf ("%d",&n); for (int i=0;i C、 #include #include #include #include #include #include using namespace std; typedef long long LL; int main() { cin.tie(0); set mh; vector ml; int n,m; scanf ("%d%d",&n,&m); for (int i=0;i>s; ml.push_back(s); } for (int i=0;i>s; mh.insert(s); } for (string s:ml) { if (mh.count(s)) printf ("Yesn"); else printf ("Non"); } return 0; } D、 直接爆搜所有可能的情况。爆搜的时候时间复杂度是阶乘上升的,应选用好的爆搜写法,不然会TLE。 #include #include #include #include #include #include #define x first #define y second using namespace std; typedef long long LL; typedef pair PII; vector g; int a[20][20]; int res = 0; bool st[20]; int n; void dfs(int u) { if (u==2*n) { int sum = 0; for (int i=0;i 再把当时TLE的代码粘上,可以对比对比算算复杂度 #include #include #include #include #include #include #define x first #define y second using namespace std; typedef long long LL; typedef pair PII; vector g; LL a[20][20]; LL res = 0; bool st[20]; int n; int cnt =0; void dfs(int u) { if (u==n) { LL sum = 0; for (int i=0;i
#include #include #include #include #include #include using namespace std; typedef long long LL; int main() { cin.tie(0); set mh; vector ml; int n,m; scanf ("%d%d",&n,&m); for (int i=0;i>s; ml.push_back(s); } for (int i=0;i>s; mh.insert(s); } for (string s:ml) { if (mh.count(s)) printf ("Yesn"); else printf ("Non"); } return 0; }
直接爆搜所有可能的情况。爆搜的时候时间复杂度是阶乘上升的,应选用好的爆搜写法,不然会TLE。
#include #include #include #include #include #include #define x first #define y second using namespace std; typedef long long LL; typedef pair PII; vector g; int a[20][20]; int res = 0; bool st[20]; int n; void dfs(int u) { if (u==2*n) { int sum = 0; for (int i=0;i 再把当时TLE的代码粘上,可以对比对比算算复杂度 #include #include #include #include #include #include #define x first #define y second using namespace std; typedef long long LL; typedef pair PII; vector g; LL a[20][20]; LL res = 0; bool st[20]; int n; int cnt =0; void dfs(int u) { if (u==n) { LL sum = 0; for (int i=0;i
再把当时TLE的代码粘上,可以对比对比算算复杂度
#include #include #include #include #include #include #define x first #define y second using namespace std; typedef long long LL; typedef pair PII; vector g; LL a[20][20]; LL res = 0; bool st[20]; int n; int cnt =0; void dfs(int u) { if (u==n) { LL sum = 0; for (int i=0;i
上一篇 使用Termux配置Ubuntu Python开发环境
下一篇 解决selenium驱动和Chrome 不兼容问题
版权所有 (c)2021-2022 MSHXW.COM
ICP备案号:晋ICP备2021003244-6号