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

宜兴建设局的网站百度100%秒收录

宜兴建设局的网站,百度100%秒收录,猪八戒网做网站,有什么做兼职的网站比较好1.第一个题,大概题目意思是求n句话中最长的单词和最短的单词 这个题目做的有点磕巴,好几年没有写过c/c了,连string的复制都不会写了,哈哈哈,太笨了 后面一点点捡起来,还是写出来了,本身没啥&…

1.第一个题,大概题目意思是求n句话中最长的单词和最短的单词
这个题目做的有点磕巴,好几年没有写过c/c++了,连string的复制都不会写了,哈哈哈,太笨了
后面一点点捡起来,还是写出来了,本身没啥;
第一:整行读入,要自己分单词
第二: 就是复制的时候是浅层copy还是深层copy,这里也忘记那个是深那个是浅了,反正就是一个直接复制地址,一个是复制内容。
粗暴的代码:


#include<vector>
#include<cmath>
#include<cstring>
#include <iostream>
#include<algorithm>
using namespace std;
vector<string> str;
vector<int> str_leng;
int main(){int num;cin >> num;string line;int min_num=10000;int max_num=0;char max_str[1000]="",min_str[1000]="";getline(cin,line);while(num){getline(cin,line);if (1){
//             cout <<num<< line << endl;int len=0;char tmp[1000]="";for (int i=0;i<line.length();i++){if (line[i]!=' '){tmp[len]=line[i];len++;}if(line[i]==' ' | i==line.length()-1){tmp [len]='\0';
//                     cout<<tmp<<" len: "<<len<<endl;if (len>max_num){
//                         cout<<tmp<<endl;max_num=len;strcpy(max_str,tmp);}if(len<min_num){
//                          cout<<"min: "<<tmp<<endl;min_num = len;strcpy(min_str,tmp);}len=0;strcpy(tmp,"");}}}num--;}cout<<max_str<<endl;cout<<min_str<<endl;return 0;
}

2、就是对n个学生进行按成绩从高到低进行排序,成绩重复的按名字字典序从小到大排序
这里就是自己设置一个学生结构体,然后自定义个结构体排序就好了
还可以的代码:

沉默:
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;struct student{char  name[20];int score;
};
bool com(const student x,const student y)
{if(x.score==y.score)return x.name<y.name;return x.score>y.score;
}
int main(){int n;cin >>n;student std[30];for(int i=0;i<n;i++){cin >> std[i].name >> std[i].score;}sort(std,std+n,com);for(int i=0;i<n;i++){cout<<std[i].name<<" "<<std[i].score<<endl;}return 0;
}

3题
请添加图片描述
代码:
数学计算题:

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;int main(){int n=1;int res=0;int tmp =0;for (int i=0;i<1;i++){tmp = (n+1)*2;n = tmp;}cout<< n<<endl;return 0;
}

请添加图片描述
用队列来表示能生存的数字,被队列抛弃的就是死掉的数字,最后只剩一个数的时候,就是最终答案。

#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
queue<int> q1;
int main(){int n;cin>>n;int id=1;int num=1;q1.push(id);bool flag=false;while(!q1.empty()){if(flag && q1.size()==1){cout<<q1.front()<<endl;return 0;}num++;if (id<n && !flag){id++;}else{flag=true;id=q1.front();q1.pop();}if(num==3){num=0;}else{q1.push(id);}}return 0;
}
http://www.hkea.cn/news/521988/

相关文章:

  • 网站建设官网免费模板杭州seo优化
  • 绍兴网站建设谷歌搜索引擎在线
  • 网站的会员认证怎么做黑龙江新闻头条最新消息
  • 做网站如何分工百度推广登录平台客服
  • 网站建设如何提案万网域名注册信息查询
  • 创意二维码制作网站企业网络营销推广案例
  • 论坛型网站怎么做百度高级检索入口
  • 做百度移动网站排搜素引擎优化
  • 公司创建一个网站需要多少钱想做百度推广找谁
  • 做文献ppt模板下载网站有哪些常德政府网站
  • 青岛网站建设公司排行外链工具在线
  • 网站怎么做显得简洁美观seo数据是什么意思
  • 阿里巴巴开通诚信通后网站怎么做网络优化网站
  • 东莞手机网站价格便宜个人免费建站软件
  • 电子商务网站建设的步骤一般为百度100%秒收录
  • 做企业网站怎么样免费的推广软件下载
  • 拓普网站建设美国搜索引擎
  • 网站开发者工资冯耀宗seo视频教程
  • 软件开发各阶段工作量比例搜索引擎优化的基础是什么
  • 网站怎么做才能将名声打响云搜索app
  • 南阳做网站优化哪家好一级域名生成二级域名
  • 3322动态域名官网郑州seo联系搜点网络效果好
  • 网络营销渠道的类型河北seo基础教程
  • 做微信网站多少钱seo内部优化包括哪些内容
  • 中国城乡建设网站网络优化公司排名
  • 个人网站做淘宝客教程torrentkitty磁力搜索引擎
  • 广州北京网站建设seo培训讲师招聘
  • 手机上免费自己做网站网络营销案例分享
  • 长沙大型网站建设谷歌账号
  • 大兴德艺网站建设发布悬赏任务的推广平台