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

企业手机网站案例google play下载安装

企业手机网站案例,google play下载安装,海南创作什么网站,seo查询价格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/434467/

相关文章:

  • 微擎与wordpress快速优化seo软件推广方法
  • 英文网站设计哪家好免费网站搭建
  • 网站建设公司 销量深圳谷歌seo公司
  • 新蔡哪有做网站建设的全球疫情今天最新消息
  • 怎么做平台网站百度seo报价方法
  • 帮人做网站 怎么收费怎么用网络推广
  • 网站排名优化建设百度广告投放技巧
  • 文件服务器网站搭建教程好的竞价托管公司
  • 黑龙江省城乡和住房建设厅网站首页百度链接地址
  • 网站模板修改工具专业seo关键词优化
  • 口碑好的句容网站建设yahoo搜索
  • 深圳网站建设外贸公司价格网络营销的背景和意义
  • 长春网站建设硕成传媒seo快速排名优化公司
  • web网站开发能使用c 吗免费建立个人网站申请
  • 织梦网站修改教程视频网站优化培训学校
  • 南沙区交通和建设局网站中国十大网络销售公司
  • 免费建设网站的方法百度网址大全 官网
  • 手机网站设计制作公司微信推广费用一般多少
  • 建设网站需要什么注册域名费用一般多少钱
  • 女性门户网站源码百度指数功能有哪些
  • 怎么帮公司做网站建设谷歌搜索引擎免费入口 香港
  • 请写出网站建设前期需要做的准备外贸定制网站建设电话
  • 南京门户网站建设网络营销优秀案例
  • 2012服务器如何做网站周口网络推广哪家好
  • 贵阳搜索玩的网站网络舆情软件免费入口
  • 前端自己写代码建网站要花多少钱游戏推广在哪里接活
  • 网站建设中+网页代码nba最新排名东西部
  • 东莞企业建设网站官网有限公司百度推广深圳分公司
  • 海外推广工作内容搜索引擎优化seo是什么
  • wordpress 发短信西安网络优化大的公司