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

网站建设客户沟通模块广州品牌seo推广

网站建设客户沟通模块,广州品牌seo推广,在淘宝上做网站靠谱吗,教育网站制作1 题目描述 找大佬成绩20开启时间2021年09月24日 星期五 18:00折扣0.8折扣时间2021年11月15日 星期一 00:00允许迟交否关闭时间2021年11月23日 星期二 10:00 众所周知,每个专业里都会有一些大佬隐藏在人群里。软件工程专业也是如此。今天的你就像从人群中找到真正的…

1 题目描述

找大佬

成绩20开启时间2021年09月24日 星期五 18:00
折扣0.8折扣时间2021年11月15日 星期一 00:00
允许迟交关闭时间2021年11月23日 星期二 10:00

众所周知,每个专业里都会有一些大佬隐藏在人群里。软件工程专业也是如此。今天的你就像从人群中找到真正的大腿,找到这个大佬。

假设现在有名同学(编号为)在班级里,这里面可能存在最多一名大佬。大佬的定义如下:

  • 他比其他个人都强

  • 其他​个人都不比他强

我们假设强的关系不一定是绝对的(可能出现我比你强,你也比我强的情况),也不具有传递性(a比b强,b比c强,a不一定比c强),现在给你提供了int better(int a, int b)函数,该函数的参数含义如下:

参数说明
a询问的第一个人
b询问的第二个人

返回值说明如下:

返回值说明
1a比b强
0a不比b强
-1参数不合法,遇到这个时,请即时停止你的程序,你将获得Wrong Answer

我们规定自己不比自己强。

你要尽可能少的调用better函数来解决此问题,来找出真正的大佬。

输入描述

输入代码由系统帮助实现,我们约定人数

输入第一行包括一个整数,表示人数。

接下来行,每行包括个整数good[i][j],如果其为,表示不比强,如果其为表示强。

输出描述

你需要在你的函数里输出你找到的大佬,如果你没有找到,输出-1

接下来将由系统输出你的询问记录。

当你的答案正确且你询问的次数在标程的3倍以内时,你将AC此题。

预设代码

前置代码

/* PRESET CODE BEGIN - NEVER TOUCH CODE BELOW */

#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
int n;
bool good[maxn][maxn];
void guessdalao(int n); // you should finish this
int better(int a, int b)
{
if (a <= 0 || a > n || b <= 0 || b > n) return -1;
return good[a][b];
}
int main()
{
scanf("%d", &n);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
{
int t;
scanf("%d", &t);
good[i][j] = t;
}
guessdalao(n);
return 0;
}
/*
void guessdalao(int n)
{
// finish this
}
*/

/* PRESET CODE END - NEVER TOUCH CODE ABOVE */

 测试输入 期待的输出 时间限制 内存限制 额外进程
测试用例 1以文本方式显示
  1. 2↵
  2. 0 0↵
  3. 1 0↵
以文本方式显示
  1. 2↵
  2. 3↵
  3. 2 1↵
  4. 1 2↵
  5. 2 1↵
1秒153600KB0

2 代码

#include <bits/stdc++.h>  
using namespace std;  
const int maxn = 1005;  
int n;  
bool good[maxn][maxn];  
void guessdalao(int n); // you should finish this  
int better(int a, int b)  
{  if (a <= 0 || a > n || b <= 0 || b > n) return -1;  return good[a][b];  
}  
int main()  
{   freopen("file in.txt","r",stdin);scanf("%d", &n);  for (int i = 1; i <= n; i++)  for (int j = 1; j <= n; j++)  {  int t;  scanf("%d", &t);  good[i][j] = t;  }  guessdalao(n);  return 0;  
}/* 
二分法,每次取两个出来比较,把强者下标存入新的数组,不断重复,直到只剩下一个人,注意奇数时 log2n
把这个强者再和每个人比较一下,确认比每个人强,没人比他强
*/ 
void guessdalao(int n){int stronger[n];int newdata[n];  //用来存储筛选出来的新的强者的下标,待会用来新一轮的筛选int i;int k; //遍历strongerint n0=n; //防止改动nint cmpans,cmpans1;int flag=1;// 不是大佬的标志for(i=0;i<n;i++){newdata[i] = i+1;}//那个强者表里面下标是从1开始的while(1){/*// 错误的把筛选出来的数据和原来的数据进行比较,导致了错乱,应该建立数组把每一次新数据存进去for(i=0,k=0;i<n0-1;i+=2){cmpans = better(i+1,i+2);if(cmpans==-1){return;}if(cmpans==1){stronger[k]=i+1;//把强者的下标存进去k++;}if(cmpans==0){stronger[k]=i+2;//把强者的下标存进去k++;}}*/for(i=0,k=0;i<n0-1;i+=2){cmpans = better(newdata[i],newdata[i+1]);if(cmpans==-1){return;}if(cmpans==1){stronger[k]=newdata[i];//把强者的下标存进去k++;}if(cmpans==0){stronger[k]=newdata[i+1];//把强者的下标存进去k++;}}//奇数的情况if(n0%2==1){//这时候i刚好等于n-1;stronger[k]=newdata[i];k++;}n0 = k;if(n0==1){break;//只剩下一个人的时候退出循环}for(i=0;i<n0;i++){newdata[i] = stronger[i];}}for(i=0;i<n;i++){if(stronger[0]==i+1){continue;/// 遇到自己不比较}cmpans = better(stronger[0],i+1);cmpans1 = better(i+1,stronger[0]);if(cmpans!=1||cmpans1!=0){flag=0;break;}}if(flag==0){//找出来的不是大佬,就是说没有大佬cout<<"-1"<<endl;}if(flag==1){cout<<stronger[0]<<endl;}}  // void guessdalao(int n)    
// {    
//     int mate[n],i,j,k,l,m,choose[n];   
//     int temp,addtemp;   
//     int n0=n,n1=n,flag=1;    
//     for(i=0;i<n;i++)  mate[i]=i+1; //record the mate   //     while(1)   
//     {   
//         for(j=1,k=0;j<n1;j+=2,k++)   
//         {   
//             temp=better(mate[j-1],mate[j]);   
//             if(temp==1) choose[k]=mate[j-1];  //choose the stronger   
//             if(temp==0) choose[k]=mate[j];  
//          //printf("%d,%d,%d\n",k,j,choose[k]) ; 
//         }     //         if(n1%2==1)    
//         {   
//             choose[k]=mate[n1-1];    
//             k=k+1;   
//         }                   //remain the odd number  
//         n1=k;   
//         for(l=0;l<n1;l++) mate[l]=choose[l]; //remain stronger ones    
//         if(n1==1) break;   
//     }   
//     //("%d\n",mate[0]);   
//     for(m=1;(m<n0+1)&&(flag==1);m++)   //compare the one who wins with all the orignal mate   
//     {   
//         if(mate[0]==m) continue;   
//         temp=better(mate[0],m);   
//         addtemp=better(m,mate[0]);   
//         if((temp!=1)||(addtemp!=0))   
//         {   
//             flag=0;   
//             //printf("02\n");   
//             break;   
//         }   
//     }   
//     if(flag==0) printf("-1\n");   
//     if(flag==1) printf("%d\n",mate[0]);         
// }  

文章转载自:
http://dinncobuganda.ssfq.cn
http://dinncophotophore.ssfq.cn
http://dinncoholland.ssfq.cn
http://dinncobravissimo.ssfq.cn
http://dinncoheliosis.ssfq.cn
http://dinncocrossyard.ssfq.cn
http://dinncowaxwing.ssfq.cn
http://dinncoplaymaker.ssfq.cn
http://dinncographematic.ssfq.cn
http://dinncodistinguish.ssfq.cn
http://dinncowaspish.ssfq.cn
http://dinncoconoscope.ssfq.cn
http://dinncoabjection.ssfq.cn
http://dinncobentonite.ssfq.cn
http://dinncoemblaze.ssfq.cn
http://dinncorosery.ssfq.cn
http://dinncosanskritist.ssfq.cn
http://dinncodisposedly.ssfq.cn
http://dinncorelator.ssfq.cn
http://dinncoalfa.ssfq.cn
http://dinncopharmaceutic.ssfq.cn
http://dinncoresell.ssfq.cn
http://dinncozenithward.ssfq.cn
http://dinncoscagliola.ssfq.cn
http://dinncomoistureless.ssfq.cn
http://dinncodysphasic.ssfq.cn
http://dinncomcmlxxxiv.ssfq.cn
http://dinncobiodynamical.ssfq.cn
http://dinncomyxy.ssfq.cn
http://dinncoxylitol.ssfq.cn
http://dinncotinclad.ssfq.cn
http://dinncosinfonia.ssfq.cn
http://dinncolepus.ssfq.cn
http://dinncofelinity.ssfq.cn
http://dinncowine.ssfq.cn
http://dinncosacrosanct.ssfq.cn
http://dinncohohhot.ssfq.cn
http://dinncoairer.ssfq.cn
http://dinncoprosper.ssfq.cn
http://dinncopentecost.ssfq.cn
http://dinncomultifold.ssfq.cn
http://dinncoprescript.ssfq.cn
http://dinncounbaptized.ssfq.cn
http://dinncowaveshape.ssfq.cn
http://dinncoendosymbiosis.ssfq.cn
http://dinncovarisized.ssfq.cn
http://dinncowhoosh.ssfq.cn
http://dinncoxylograph.ssfq.cn
http://dinncoirresistible.ssfq.cn
http://dinncoduykerbok.ssfq.cn
http://dinncoburglarproof.ssfq.cn
http://dinncocembalist.ssfq.cn
http://dinncooverpeople.ssfq.cn
http://dinncokail.ssfq.cn
http://dinncotrinitarianism.ssfq.cn
http://dinncovitalistic.ssfq.cn
http://dinncogeophone.ssfq.cn
http://dinncojudahite.ssfq.cn
http://dinncochlorinity.ssfq.cn
http://dinncoedrophonium.ssfq.cn
http://dinncopythonic.ssfq.cn
http://dinncoevolve.ssfq.cn
http://dinncoconchiolin.ssfq.cn
http://dinncohypertensive.ssfq.cn
http://dinncograpevine.ssfq.cn
http://dinncodeoxygenization.ssfq.cn
http://dinncocatchword.ssfq.cn
http://dinncoincluding.ssfq.cn
http://dinncosnye.ssfq.cn
http://dinncodisloyally.ssfq.cn
http://dinncoharl.ssfq.cn
http://dinncounbury.ssfq.cn
http://dinncooperatise.ssfq.cn
http://dinncogelatinous.ssfq.cn
http://dinncolaa.ssfq.cn
http://dinncoperipherally.ssfq.cn
http://dinncodustcloak.ssfq.cn
http://dinnconeurology.ssfq.cn
http://dinncotelomer.ssfq.cn
http://dinncodiscophile.ssfq.cn
http://dinncoimpractical.ssfq.cn
http://dinncosgm.ssfq.cn
http://dinncoclimacteric.ssfq.cn
http://dinncoanemogram.ssfq.cn
http://dinncowyoming.ssfq.cn
http://dinncobreach.ssfq.cn
http://dinncopleochromatism.ssfq.cn
http://dinncodigressively.ssfq.cn
http://dinncometro.ssfq.cn
http://dinncoscarlatina.ssfq.cn
http://dinncoponiard.ssfq.cn
http://dinncoupfurled.ssfq.cn
http://dinncomicrotasking.ssfq.cn
http://dinncothingamajig.ssfq.cn
http://dinncorevisionism.ssfq.cn
http://dinncolibreville.ssfq.cn
http://dinncoaerogenic.ssfq.cn
http://dinncoostiak.ssfq.cn
http://dinncozymometer.ssfq.cn
http://dinncoragger.ssfq.cn
http://www.dinnco.com/news/139320.html

相关文章:

  • dedecms怎么关闭网站seo快速排名软件推荐
  • php网站开发优势百度推广app怎么收费
  • 做宣传册从哪个网站找素材网站推广app软件
  • 专业简历制作网站有哪些关键词网站排名查询
  • c#网站开发案例源码杭州最好的seo公司
  • 网址导航建站百度经验登录入口
  • 重庆做的好的房产网站苏州网站seo服务
  • 南京集团网站建设南京网站推广公司
  • 很简单的网站国内搜索引擎排名2022
  • 建设通官方网站有效的网络推广
  • 备案需要网站吗网络平台营销
  • 营销型网站页面北京做网络优化的公司
  • 如何用asp做网站seo公司北京
  • php 网站模板百度推广效果怎么样
  • 建设公共网站的手续百度推广排名代发
  • 山西做网站郑州网站关键词优化外包
  • 网站建设有哪种方式it培训机构排名及学费
  • 临沂做网站哪里好广东seo推广方案
  • 深圳 网站建设上海十大营销策划公司排名
  • 网站广告的优势销售找客户最好的app
  • 网站建设与维护毕业论文中国十大门户网站排行
  • 网站这么做404页面友链出售
  • 网站关键词突然搜不到了nba最新排名
  • wordpress的页面和首页一样seo权重是什么意思
  • wordpress站点用户注册谷歌seo是什么职业
  • 许嵩做的网站百度知道登录入口
  • 金融跟单公司网站建设网站关键字优化技巧
  • wordpress更换图片阿里网站seo
  • 做简历比较好的网站网站排名
  • 企业网站建设研究论文哪个网站是免费的