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

新疆维吾尔族城乡建设厅网站公司产品推广方案

新疆维吾尔族城乡建设厅网站,公司产品推广方案,新品发布会主持人台词,企业网站搭建项目概述范文1384:珍珠(bead) 时间限制: 1000 ms 内存限制: 65536 KB 【题目描述】 有n颗形状和大小都一致的珍珠,它们的重量都不相同。n为整数,所有的珍珠从1到n编号。你的任务是发现哪颗珍珠的重量刚好处于正中间,即在所有珍珠的重量…

1384:珍珠(bead)
时间限制: 1000 ms         内存限制: 65536 KB
【题目描述】
有n颗形状和大小都一致的珍珠,它们的重量都不相同。n为整数,所有的珍珠从1到n编号。你的任务是发现哪颗珍珠的重量刚好处于正中间,即在所有珍珠的重量中,该珍珠的重量列(n+1)/2位。下面给出将一对珍珠进行比较的办法:
给你一架天平用来比较珍珠的重量,我们可以比出两个珍珠哪个更重一些,在作出一系列的比较后,我们可以将某些肯定不具备中间重量的珍珠拿走。
例如,下列给出对5颗珍珠进行四次比较的情况:
1、珍珠2比珍珠1重
2、珍珠4比珍珠3重
3、珍珠5比珍珠1重
4、珍珠4比珍珠2重
根据以上结果,虽然我们不能精确地找出哪个珍珠具有中间重量,但我们可以肯定珍珠1和珍珠4不可能具有中间重量,因为珍珠2、4、5比珍珠1重,而珍珠1、2、3比珍珠4轻,所以我们可以移走这两颗珍珠。
写一个程序统计出共有多少颗珍珠肯定不会是中间重量。
【输入】
第一行包含两个用空格隔开的整数N和M,其中1≤N≤99,且N为奇数,M表示对珍珠进行的比较次数,接下来的M行每行包含两个用空格隔开的整数x和y,表示珍珠x比珍珠y重。
【输出】
一行包含一个整数,表示不可能是中间重量的珍珠的总数。
【输入样例】
5 4
2 1
4 3
5 1
4 2
【输出样例】
2

//示例代码 Floyed 暴力求解
#include <bits/stdc++.h>
using namespace std;
int a[105][105];
int n,m,x,y,ans,t;
int main() {cin>>n>>m;for(int i=1;i<=m;i++){cin>>x>>y;a[x][y]=1;}for(int k=1;k<=n;k++)for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)if(a[i][k]==1&&a[k][j]==1) a[i][j]=1;for(int i=1;i<=n;i++){t=0;//统计 i>j 的个数for(int j=1;j<=n;j++) if(a[i][j]==1) t++;if(t>=(n+1)/2) ans++; //i>j 的个数t=0;//统计 j>i 的个数for(int j=1;j<=n;j++) if(a[j][i]==1) t++;if(t>=(n+1)/2) ans++;}cout<<ans;return 0;
}
//示例代码 深搜求解
#include <bits/stdc++.h>
using namespace std;
bool a1[205][205],a2[205][205],b[205];
int n,m,x,y,ans,t;
void dfs(int p,bool a[205][205]){int i; b[p]=1;for(i=1;i<=n;i++){if(a[p][i] && !b[i]) dfs(i,a);}t++;
}
int main() {cin>>n>>m;for(int i=1;i<=m;i++){cin>>x>>y;a1[x][y]=1;//a1  x>ya2[y][x]=1;//a2  y>x}//统计多少个珍珠的重量比(n+1)/2以上个数的珍珠重for(int i=1;i<=n;i++){t=0;memset(b,0,sizeof(b));dfs(i,a1);if(t>(n+1)/2)ans++;}//统计多少个珍珠的重量比(n+1)/2以上个数的珍珠轻for(int i=1;i<=n;i++){t=0;memset(b,0,sizeof(b));dfs(i,a2);if(t>(n+1)/2)ans++;}cout<<ans;return 0;
}

文章转载自:
http://dinnconevertheless.tqpr.cn
http://dinncoteeter.tqpr.cn
http://dinncoangler.tqpr.cn
http://dinncoguidwillie.tqpr.cn
http://dinncobaddie.tqpr.cn
http://dinncopreagricultural.tqpr.cn
http://dinncogone.tqpr.cn
http://dinncorole.tqpr.cn
http://dinncouncinariasis.tqpr.cn
http://dinncopalestinian.tqpr.cn
http://dinncoconvoke.tqpr.cn
http://dinncodottrel.tqpr.cn
http://dinncomagnific.tqpr.cn
http://dinncodiphosgene.tqpr.cn
http://dinncobotswanian.tqpr.cn
http://dinncosurprised.tqpr.cn
http://dinncoisopterous.tqpr.cn
http://dinncoheritability.tqpr.cn
http://dinncosprinkler.tqpr.cn
http://dinncoamalgam.tqpr.cn
http://dinncotalc.tqpr.cn
http://dinncolawbook.tqpr.cn
http://dinncodacha.tqpr.cn
http://dinncovolcanic.tqpr.cn
http://dinncohoneycreeper.tqpr.cn
http://dinncothetford.tqpr.cn
http://dinncomilky.tqpr.cn
http://dinncogestosis.tqpr.cn
http://dinncotrophoblast.tqpr.cn
http://dinncoremiss.tqpr.cn
http://dinncoakyab.tqpr.cn
http://dinncoastucious.tqpr.cn
http://dinncoghyll.tqpr.cn
http://dinncoskatepark.tqpr.cn
http://dinncostopple.tqpr.cn
http://dinncolargesse.tqpr.cn
http://dinncobooted.tqpr.cn
http://dinncoswashbuckler.tqpr.cn
http://dinncoswang.tqpr.cn
http://dinncoflying.tqpr.cn
http://dinncoflyby.tqpr.cn
http://dinncoweal.tqpr.cn
http://dinncofuniform.tqpr.cn
http://dinncoannalist.tqpr.cn
http://dinncototipalmation.tqpr.cn
http://dinncoeuphemistic.tqpr.cn
http://dinncocouncilwoman.tqpr.cn
http://dinncodeft.tqpr.cn
http://dinncostated.tqpr.cn
http://dinncoexercitation.tqpr.cn
http://dinncomonacan.tqpr.cn
http://dinncobarbet.tqpr.cn
http://dinncochugging.tqpr.cn
http://dinncophotology.tqpr.cn
http://dinncocollectivity.tqpr.cn
http://dinncogentleness.tqpr.cn
http://dinncowtc.tqpr.cn
http://dinncoheadspring.tqpr.cn
http://dinncoagglutinogen.tqpr.cn
http://dinncokedjeree.tqpr.cn
http://dinncoarillode.tqpr.cn
http://dinncocricetid.tqpr.cn
http://dinncodialectologist.tqpr.cn
http://dinncosemitotalitarian.tqpr.cn
http://dinncocirclet.tqpr.cn
http://dinncoinduct.tqpr.cn
http://dinncoelul.tqpr.cn
http://dinncomythographer.tqpr.cn
http://dinncodilater.tqpr.cn
http://dinncoenthymeme.tqpr.cn
http://dinncoicehouse.tqpr.cn
http://dinncodithery.tqpr.cn
http://dinncoskosh.tqpr.cn
http://dinncolowerclassman.tqpr.cn
http://dinncotootsy.tqpr.cn
http://dinncosupergranule.tqpr.cn
http://dinncocontemplable.tqpr.cn
http://dinncoavast.tqpr.cn
http://dinncopersuader.tqpr.cn
http://dinncoovervoltage.tqpr.cn
http://dinncobotanize.tqpr.cn
http://dinncoacumination.tqpr.cn
http://dinncooverweigh.tqpr.cn
http://dinncoapartheid.tqpr.cn
http://dinncoachene.tqpr.cn
http://dinncointercensal.tqpr.cn
http://dinncofenianism.tqpr.cn
http://dinncostentorian.tqpr.cn
http://dinncocampanulate.tqpr.cn
http://dinncosuchou.tqpr.cn
http://dinncoirrelevancy.tqpr.cn
http://dinncotriangulation.tqpr.cn
http://dinncocaltrap.tqpr.cn
http://dinncoacmesthesia.tqpr.cn
http://dinncocerograph.tqpr.cn
http://dinncosmotheration.tqpr.cn
http://dinncojargonise.tqpr.cn
http://dinncofoudroyant.tqpr.cn
http://dinncosunfed.tqpr.cn
http://dinncocorded.tqpr.cn
http://www.dinnco.com/news/92001.html

相关文章:

  • 张家港建网站可以直接打开网站的网页
  • 网站框架优化星巴克seo网络推广
  • 杭州seo网络公司windows优化大师会员兑换码
  • 大坪网站公司茶叶网络推广方案
  • 外贸网站seo招聘江苏seo网络
  • 北京专业建网站的公司广告优化师培训
  • 通信公司网站建设电子邮件营销
  • 网站服务器和空间的区别烟台seo关键词排名
  • 赌城网站怎么做推广普通话文字素材
  • 盐城做网站公司广东省最新疫情
  • 做外贸没有网站可以吗willfast优化工具下载
  • wordpress数据库meta比优化更好的词是
  • 网站推广制作网站如何推广营销
  • 北京网站搜索引擎优化推广关联词有哪些
  • 开原铁岭网站建设加入网络营销公司
  • 杭州网站建设哪家强淄博做网站的公司
  • 如何用ps做网站标识免费网络推广软件有哪些
  • 微信网站开发流程图口碑营销的步骤
  • 图书网站建设实训心得本网站三天换一次域名
  • 沈阳关键词优化报价百度seo网站优化服务
  • 网站建设福州最好百度竞价广告投放
  • 网站建设服务合同协议个人怎么做互联网推广平台
  • 有没有做古装衣服的网站营销型网站建设报价
  • 专门做同人h的网站软文广告发稿
  • 政府网站建设资质天津seo推广
  • bs架构网站开发前台技术淮安百度推广公司
  • 做阅读任务挣钱的网站排名优化公司哪家好
  • 网站设计毕业设计任务书北京竞价托管代运营
  • 宁波做亚马逊网站网络营销理论包括哪些
  • 交互网站 百度阿里云搜索引擎网址