中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當前位置: 首頁 > news >正文

一個獨立IP做幾個網(wǎng)站比較合適seo網(wǎng)站建設(shè)優(yōu)化

一個獨立IP做幾個網(wǎng)站比較合適,seo網(wǎng)站建設(shè)優(yōu)化,天津網(wǎng)站seo服務(wù),展廳布局設(shè)計平面圖Description 輸出給定序列按字典序的 � 組合,按照所有 � 個元素出現(xiàn)與否的 01 標記串 ����?1,...,�1 的字典序輸出. 此處01串的字典序指:先輸入的數(shù)字對應(yīng)低位&#x…

Description

輸出給定序列按字典序的?�?組合,按照所有?�?個元素出現(xiàn)與否的?01?標記串?����?1,...,�1?的字典序輸出.

此處01串的字典序指:先輸入的數(shù)字對應(yīng)低位,后輸入的數(shù)字對應(yīng)高位,從高位到低位第一個不一樣的位為1的字典序靠后.

Input

第一行集合元素個數(shù)?1≤�≤10?及子集元素個數(shù)?1≤�≤�,第二行?�?個空格隔開的正整數(shù)?1≤��≤100.

Output

每組數(shù)據(jù)輸出所有對應(yīng)的每個組合,每個一行用空格隔開。

Sample

#0
Input

Copy

5 3
3 1 2 4 5
Output

Copy

3 1 2
3 1 4
3 2 4
1 2 4
3 1 5
3 2 5
1 2 5
3 4 5
1 4 5
2 4 5

Hint

樣例中:{3,1,4}表示01011——5(0)4(1)2(0)1(1)3(1),{1,2,5}表示10110——5(1)4(0)2(1)1(1)3(0),則{1,2,5}的字典序比{3,1,4}靠后.

題目有點難懂

方法用回溯求組合數(shù)然后排序

#include <iostream>
#include <cstring>
#include <queue>
#include <climits>
#include "vector"
#include "set"
#include "string"
#include "cmath"
#include "algorithm"
using namespace std;
int a[15];
int use[15];
int weight[105];
int n,r;
//3 1 2 4 5
//1 1 1 0 0
//1 1 0 1 0
bool cmp(vector<int>v1,vector<int>v2){int s1=0,s2=0;for(int j=n-1;j>=0;j--){if(std::find(v1.begin(), v1.end(),a[j])!=v1.end()){s1=1;}if(std::find(v2.begin(), v2.end(),a[j])!=v2.end()){s2=1;}if(s1!=s2){if(s1==0){return true;}else{return false;}}s1=0,s2=0;}
}
void backtrack(int a[],int n,int r,vector<int>&temp,vector<vector<int>>&ans){if(temp.size()==r){ans.push_back(temp);return;}for(int i=0;i<n;i++){if(use[i]==0&&((!temp.empty()&&weight[a[i]]<weight[temp[temp.size()-1]])||temp.empty())){use[i]=1;temp.push_back(a[i]);backtrack(a,n,r,temp,ans);temp.pop_back();use[i]=0;}}
}
int main()
{while(cin>>n>>r){memset(use,0, sizeof(use));for(int i=0;i<n;i++){cin>>a[i];weight[a[i]]=n-i;}vector<int>temp;vector<vector<int>>ans;backtrack(a,n,r,temp,ans);sort(ans.begin(),ans.end(), cmp);for(int i=0;i<ans.size();i++){for(int j=0;j<r;j++){cout<<ans[i][j]<<" ";}cout<<endl;}cout<<endl;}return 0;
}

http://www.risenshineclean.com/news/4681.html

相關(guān)文章:

  • 人妖和美女做視頻網(wǎng)站如何建立公司網(wǎng)站網(wǎng)頁
  • 網(wǎng)站建設(shè)合同糾紛問題百度廣告聯(lián)盟賺廣告費
  • 官方網(wǎng)站建設(shè)要點最近三天的新聞大事簡短
  • 太平洋保險網(wǎng)站做的這么爛打廣告推廣怎么做
  • 分類網(wǎng)站建設(shè)方案廣州網(wǎng)站優(yōu)化
  • 怎么找網(wǎng)站模板seo搜索引擎入門教程
  • 網(wǎng)站開發(fā)有哪些要求咖啡seo是什么意思
  • 泰安做網(wǎng)站哪家好企業(yè)網(wǎng)站制作方案
  • 浦東新區(qū)網(wǎng)站建設(shè)公司哪家靠譜奇葩網(wǎng)站100個
  • html 網(wǎng)站地圖北京seo顧問推推蛙
  • 臨沂最好的做網(wǎng)站公司網(wǎng)絡(luò)推廣費用高嗎
  • 網(wǎng)站開發(fā)需要團隊怎么做互聯(lián)網(wǎng)推廣
  • 上海高端定制網(wǎng)站公司河南企業(yè)網(wǎng)站建設(shè)
  • 有人知道網(wǎng)站怎么做嗎海外網(wǎng)站
  • 濟南網(wǎng)站建設(shè)599網(wǎng)絡(luò)推廣的方法有
  • 上海網(wǎng)站建設(shè)公司地廣州專業(yè)seo公司
  • 如何查到別人的網(wǎng)站做哪些競價詞友情鏈接查詢友情鏈接檢測
  • wordpress如何建站群百度數(shù)據(jù)分析工具
  • W做網(wǎng)站最佳bt磁力狗
  • 難道做網(wǎng)站必須用vue框架嗎系統(tǒng)優(yōu)化軟件哪個好
  • 食品行業(yè)網(wǎng)站開發(fā)seo資源咨詢
  • 現(xiàn)在什么視頻網(wǎng)站做的最好網(wǎng)絡(luò)營銷論文
  • 最新的網(wǎng)站建設(shè)軟件百度個人中心登錄
  • 工業(yè)設(shè)計專業(yè)就業(yè)前景怎么樣百度優(yōu)化服務(wù)
  • 網(wǎng)站內(nèi)怎樣做關(guān)鍵詞有效果網(wǎng)絡(luò)優(yōu)化論文
  • 賺錢網(wǎng)站開發(fā)天津百度推廣
  • 凡客誠品是品牌嗎廣州seo外包
  • 阿里巴巴批發(fā)網(wǎng)站上面怎么做微商單頁網(wǎng)站制作
  • 網(wǎng)站建設(shè)宗旨怎么寫谷歌推廣效果怎么樣
  • 項目網(wǎng)站建設(shè)方案佛山網(wǎng)站建設(shè)工作