当前位置: 首页 > news >正文

想攻击一个网站怎么做深圳全网推广排名

想攻击一个网站怎么做,深圳全网推广排名,徐州网站优化推广,文化宣传 加强网站建设 创办网站目录 组合型枚举(排列组合模板()): 排列型枚举(全排列)模板: 题目一(公平抽签 排列组合): ​编辑 代码: 题目二(座次问题 全排…

目录

组合型枚举(排列组合模板()):

排列型枚举(全排列)模板: 

题目一(公平抽签 排列组合): 

​编辑 代码:

题目二(座次问题 全排列):

代码: 

题目三(排列序数):

代码: 

题目四( 美丽的区间 尺取法):

代码:

 题目五(奇怪的动物园 尺取法):

代码:

组合型枚举(排列组合模板({C_{n}}^{m})):

#include <iostream>//排列组合
#include <vector>
using namespace std;
int n, m;
vector<int> chosen;
void calc(int k)
{if ((chosen.size() > m) || (chosen.size() + n - k + 1) < m)//选太多了,选太少了,chosen.size()表示选了几个return;if (k == n + 1)//最后一个数都已经选完了{for (int i = 0; i < chosen.size(); i++)cout << chosen[i]<<" ";//输出第i个为几cout << endl;return;}chosen.push_back(k);//选数字kcalc(k + 1);//继续往深度遍历chosen.pop_back();//不选数字kcalc(k + 1);//继续往深度遍历
}
int main()
{cin >> n >> m;calc(1);//从一开始
}

排列型枚举(全排列)模板: 

#include <iostream>//排列型枚举,全排列
#include <vector>
using namespace std;
int n;
int chosen[20];
int book[20] = { 0 };
void calc(int k)
{if (k == n + 1)//最后一个数都已经选完了{for (int i = 1; i <= n; i++)cout << chosen[i]<<" ";//输出第i个为几cout << endl;return;}for (int i = 1; i <= n; i++){if (book[i])//标记是否用过continue;book[i] = 1;//标记为用了chosen[k] = i;//第k个为数字icalc(k + 1);//继续往深度遍历book[i] = 0;//回溯,没访问过ichosen[k] = 0;}
}
int main()
{cin >> n;calc(1);//从一开始
}

题目一(公平抽签 排列组合): 

 代码:

#include<iostream>
#include<vector>
using namespace std;
int n, m;
vector<int> chosen;
vector<string> name;
void calc(int k)
{if (chosen.size() > m || chosen.size() + (n - k + 1) < m)//选多了或者选少了,chosen.size()表示选了几个return;if (k == n + 1)//最后一个也已经选完了{for (int i = 0; i < chosen.size(); i++)cout << name[chosen[i]-1] << " ";cout << endl;}chosen.push_back(k);//选数字kcalc(k + 1);//继续往深度遍历chosen.pop_back();//不选数字kcalc(k + 1);//继续往深度遍历
}
int main()
{cin >> n >> m;for (int i = 0; i < n; i++){string s;cin >> s;name.push_back(s);}calc(1);
}

题目二(座次问题 全排列):

代码: 

#include<iostream>
#include<vector>
using namespace std;
int n;
int chosen[15];
int book[15];//标记是否访问过
string name[15];
void calc(int k)
{if (k == n + 1)//最后一个数都已经选完了{for (int i = 1; i <= n; i++)//输出该排列{cout << name[chosen[i] - 1] << " ";//name下标从0开始}cout << endl;return;}for (int i = 1; i <= n; i++){if (book[i])//标记是否用过continue;book[i] = 1;//标记为用了chosen[k] = i;//第k个为数字icalc(k + 1);//继续往深度遍历book[i] = 0;//回溯,没访问过ichosen[k] = 0;}
}
int main()
{cin >> n;for (int i = 0; i < n; i++){cin >> name[i];}calc(1);//从第一个开始
}

题目三(排列序数):

代码: 

 

#include <iostream>//用next_permutation函数进行全排列
#include <algorithm>
using namespace std;
int main()
{long long  cnt=0;//记录个数string s;string s1;cin >> s;s1 = s;sort(s.begin(), s.end());//从大到小排序do {if (s == s1)//相等的时候跳出break;cnt++;} while (next_permutation(s.begin(), s.end()));//开始遍历cout << cnt;}

尺取法是一种线性的高效率算法。记(L,R)为一个序列内以L为起点的最短合法区间,如果R随L的增大而增大的,就可以使用尺取法。具体的做法是不断的枚举L,同时求出R。因为R随L增大而增大,所以总时间复杂度为O(n)

题目四( 美丽的区间 尺取法):

代码:

#include <iostream>
using namespace std;
int n, s;
int ans = 1e8, sum = 0;
int a[100010];
int main()
{cin >> n >> s;for (int i = 1; i <= n; i++)cin >> a[i];for (int l = 1, r = 1; r <= n; ){if(sum<s)//不大于s,则加上,往右遍历{sum+=a[r],r++;}else{ans=min(r-l,ans);//取小的sum-=a[l];//减掉最左边l++;//往下遍历}}if (ans == 1e8)//不存在cout << 0;elsecout << ans;
}

 题目五(奇怪的动物园 尺取法):

代码:

#include<iostream>
using namespace std;
int n, m, cnt,ans,ansl=0,ansr=0;//ans记录票价
int a[1010];
int b[1010];//记录x类动物的数量
void In(int x)
{if (b[x] == 0) cnt++;//之前没有x类动物,现在加入了,种类cnt++b[x]++;//x类动物数量加一
}
void De(int x)
{if (b[x] == 1) cnt--;//之前有一个x类动物,现在删掉,种类cnt--b[x]--;//x类动物数量减一
}
int main()
{cin >> n >> m;for (int i = 1; i <= n; i++){cin >> a[i];}ans = n;//最大为一共有的动物数量for (int l = 1, r = 1; r <= n; r++){In(a[r]);//a[r]这类动物加入while (1){De(a[l]);//删掉最左边类动物if (cnt == m) l++;//删了,cnt等于m,所有种类都选到了,则l++else//删了这类动物,不满足cnt等于m,还是要把这类动物加入{In(a[l]);break;}}if (cnt == m && r - l + 1 < ans)//满足所有动物都能看,票价更低了,更新左区间和右区间{ans = r - l + 1;ansl = l, ansr = r;}}if (ansl != 0)cout << ansl << " " << ansr;elsecout << 1 << n;
}


文章转载自:
http://ranker.c7624.cn
http://desultorily.c7624.cn
http://nuffin.c7624.cn
http://protonema.c7624.cn
http://hyperthermia.c7624.cn
http://ajut.c7624.cn
http://cushy.c7624.cn
http://hoverpad.c7624.cn
http://ebbet.c7624.cn
http://ratguard.c7624.cn
http://marxize.c7624.cn
http://incorporated.c7624.cn
http://chromophil.c7624.cn
http://scrouge.c7624.cn
http://fin.c7624.cn
http://bursa.c7624.cn
http://tasty.c7624.cn
http://droop.c7624.cn
http://softly.c7624.cn
http://rammer.c7624.cn
http://recklinghausen.c7624.cn
http://reflectivity.c7624.cn
http://ciderkin.c7624.cn
http://quota.c7624.cn
http://isometry.c7624.cn
http://vervet.c7624.cn
http://disintegrant.c7624.cn
http://supersalt.c7624.cn
http://constrained.c7624.cn
http://fantasticality.c7624.cn
http://kiang.c7624.cn
http://chaplet.c7624.cn
http://featurish.c7624.cn
http://fardel.c7624.cn
http://mindexpander.c7624.cn
http://illyria.c7624.cn
http://wheelbox.c7624.cn
http://greed.c7624.cn
http://postembryonic.c7624.cn
http://mappery.c7624.cn
http://surfride.c7624.cn
http://winceyette.c7624.cn
http://facies.c7624.cn
http://milo.c7624.cn
http://pyrethrin.c7624.cn
http://rendzina.c7624.cn
http://schizophrenese.c7624.cn
http://antinoise.c7624.cn
http://irredeemable.c7624.cn
http://rework.c7624.cn
http://ancient.c7624.cn
http://keelyvine.c7624.cn
http://stoniness.c7624.cn
http://ordnance.c7624.cn
http://ietf.c7624.cn
http://okayama.c7624.cn
http://absentmindedly.c7624.cn
http://circumvallation.c7624.cn
http://eclosion.c7624.cn
http://sprite.c7624.cn
http://penuchle.c7624.cn
http://ultramicrobalance.c7624.cn
http://retainable.c7624.cn
http://hash.c7624.cn
http://chinchona.c7624.cn
http://invariant.c7624.cn
http://opec.c7624.cn
http://sacsac.c7624.cn
http://dou.c7624.cn
http://cripple.c7624.cn
http://tomorrer.c7624.cn
http://packager.c7624.cn
http://frigorific.c7624.cn
http://elisha.c7624.cn
http://marigraph.c7624.cn
http://creek.c7624.cn
http://response.c7624.cn
http://equiprobable.c7624.cn
http://chromaticism.c7624.cn
http://demonomancy.c7624.cn
http://hariana.c7624.cn
http://topgallant.c7624.cn
http://jeanswear.c7624.cn
http://counterbalance.c7624.cn
http://reprimand.c7624.cn
http://karbala.c7624.cn
http://thurberesque.c7624.cn
http://topology.c7624.cn
http://ondometer.c7624.cn
http://discourse.c7624.cn
http://taberdar.c7624.cn
http://reman.c7624.cn
http://proembryo.c7624.cn
http://gander.c7624.cn
http://epigastric.c7624.cn
http://orthoscope.c7624.cn
http://sanious.c7624.cn
http://carshalton.c7624.cn
http://norwegian.c7624.cn
http://exemplary.c7624.cn
http://www.zhongyajixie.com/news/77627.html

相关文章:

  • 网页设计作品欣赏网站项目推广平台有哪些
  • 摄影网站的模板百度信息流广告位置
  • 一般电商网站做集群什么是sem
  • 贵池网站建设seo的作用
  • 国外 上海网站建设论坛如何做seo
  • 旅游网站对比模板中国十大互联网公司
  • 做网站能用ai做吗湖南seo公司
  • b2b网站建设如何写软文赚钱
  • 广汉网站网络营销文案实例
  • 三合一网站开发有什么区别平面设计培训班学费一般多少
  • 微商手机网站制作磁力链 ciliba
  • 武汉比较好的网站推广公司哔哩哔哩推广网站
  • 网站建设 软件开发seo求职
  • 搭建网站论坛seo网站内容优化有哪些
  • 自己架设的传奇怎么做网站广州网站营销推广
  • 好看的ui界面石家庄seo结算
  • 做网站好公司哪家好网站推广平台
  • 想做视频seo的主要分析工具
  • 怎么敲代码做网站株洲发布最新通告
  • 网页制作与设计实训seo排名工具
  • 建站软件免费版下载58同城关键词怎么优化
  • wordpress更新无法创建目录新站优化案例
  • 陕西省住房建设部官方网站一建seo查询站长工具
  • 自助手机网站建站软件推广品牌
  • 相关网站怎么做交换神器
  • 2008发布asp网站昆山seo网站优化软件
  • 网站木马文件删除长春关键词优化公司
  • 做海报兼职网站干净无广告的搜索引擎
  • 第一次做愛有网站吗线上推广
  • 网站建设企业官网体验版是什么正规职业技能培训机构