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

公司网站备案条件高校网站集群平台子站开发

公司网站备案条件,高校网站集群平台子站开发,建设网站有哪些公司,网络建设费计入哪个科目题意#xff1a; 给你n个居民的起始位置#xff0c;各自在长度为l的平台#xff0c;以同样的速度向左或向右走#xff0c;当碰见时往相反方向走#xff0c;问最后掉下去的居民花费的时间以及姓名。 题目#xff1a; The Disc, being flat, has no real horizon. Any a…题意 给你n个居民的起始位置各自在长度为l的平台以同样的速度向左或向右走当碰见时往相反方向走问最后掉下去的居民花费的时间以及姓名。 题目 The Disc, being flat, has no real horizon. Any adventurous sailors who get funny ideas from staring at eggs and oranges for too long and set out for the antipodes soon learned that the reason why distant ships sometimes looked as though they were disappearing over the edge of the world was that they were disappearing over the edge of the world. (Terry Pratchett -Colour of Magic) Not so long time ago people used to believe that they live on 2-D world and if they will travel long enough in one direction, they will fall down over the edge. Even when it was proved that the Earth is rounded some of them were still afraid to travel to the southern hemisphere. Try to imagine one 1-D (linear) world. On such world there are only two possible directions (left and right). All inhabitants of such world were created exactly at the same time and suddenly all of them start to move (all with same constant velocity) in one or the other direction. If two inhabitants encounter each other, they politely exchange greetings and then they turn around and start to move in an opposite direction. When an inhabitant reaches the end of the world he falls away and disappears. Your task is to determine, for a given scenario of creation, which inhabitant and when (counting from the moment of creation) will be the last one to fall away. You can assume that the time required to exchange greetings and turn around is 0. Input The input consists of multiple descriptions (data sets) of the creation moment. File structure is as follows: N LV DIR POS NAME … The first line defines the number of inhabitants (N32000). Data set starting with value N0 represents the end of the input file. The second line contains length of the world L(float) and velocity of inhabitants V(float). Both values are always positive. In next N lines the data about inhabitants are given in an order of increasing POS (positive direction): DIR – initial direction (‘p’ or ‘P’ for positive and ‘n’ or ‘N’ for negative) POS – position in the time of creation (0POSL) NAME – name of inhabitant (string up to 250 characters) Input values within one line are separated with at least one space and there will be no empty lines in input. You may assume that input is always correct and that each data set has only one unique solution. Output The output consists of one line per each input data set. The first value should be the time when the last inhabitant will fall of the linear world counting from the moment of creation. Value should be printed truncated to two decimal places in a field 13 characters wide. The second value should be the name of the inhabitant. Values should be separated with single space character. Sample Input 1 13.5 2 p 3.5 Smarty 4 10 1 p 1 Helga n 3 Joanna p 5 Venus n 7 Clever 0 Sample Output 5.00 Smarty9.00 Venus分析 1.这道题求花费最长时间不难遍历一遍即可找到难点在于找到最后一个掉下去人的姓名。 2.我们可以认为蚂蚁相遇后名字会互相交换并且擦肩而过假设行进时间最长的蚂蚁为A我们只需要关注在A的行进方向上有多少个和A反向的就能知道会有多少只蚂蚁和真正的A碰头但其实真正和A碰头的并不是最初和A反向的那些而是在A初始方向上最靠近A的那几只蚂蚁至于最终真正的A会带着谁的名字只需要求出A的初始方向上有多少个初始方向和A反向的蚂蚁就行了假设有cnt只那么真正的A最后会携带A的初始方向上从A开始往前数cnt个的那只蚂蚁的名字画画图就明白了。 3.需要注意起始ma要初始化为-1因为可能存在0.0 4.因为是直接截取的小数点后两位不是四舍五入就不能直接%.2f,类似这么求可以*100后强制转换一下再/100; 5.输出用%lf和%f的问题(后面有详细介绍)。 6.有时候题意没有分析到位就容易忽略条件像我这样的英语战五渣就忽略了两个条件1.居民位置以递增的序列给出2.输出数字应在13个字符宽的字段中被截断到小数点后两位。 题不算难但容易坑就这样吧还是平时的一些习惯没有好好养成wa了一晚上。。。。 AC代码 #includestdio.h #includestring.h #includealgorithm using namespace std; int n,a,b,loc; double l,v,ma; bool flag; struct node{double x;char direction[5];char na[255]; }s[32010]; int main(){while(~scanf(%d,n)n){ma-1;//起始ma要初始化为-1因为可能存在0.0ab0;scanf(%lf%lf,l,v);flagfalse;for(int i0;in;i){scanf(%s%lf%s,s[i].direction,s[i].x,s[i].na);if(s[i].direction[0]p||s[i].direction[0]P){if(mal-s[i].x){mal-s[i].x;loci;flagtrue;}}else {if(mas[i].x){mas[i].x;loci;flagfalse;}}}if(flag){for(int iloc;in;i){if(s[i].direction[0]n||s[i].direction[0]N)a;}loca;}else{for(int iloc;i0;i--){if(s[i].direction[0]p||s[i].direction[0]P)b;}loc-b;}printf(%13.2f %s\n,(int)(ma*100/v)/100.0,s[loc].na);}return 0; }关于输出用%lf和%f的问题 问有人告诉我不能在printf中使用%lf。为什么printf()用%f输出double型而scanf却用%lf呢 答printf的%f说明符的确既可以输出float型又可以输出double型。根据“默认参数提升”规则在printf这样的函数的可变参数列表中不论作用域内有没有原型都适用这一规则float型会被提升为double型。因此printf()只会看到双精度数。严格地讲%lf在printf下是未定义的但是很多系统可能会接受它。要确保可移植性就要坚持使用%f。
http://www.zqtcl.cn/news/769398/

相关文章:

  • 西部数码做的网站打不开哈尔滨模板建站推荐
  • 外贸网站建设流程杭州软件定制开发
  • 网站的首页面设计软文推广特点
  • 网站描述在哪里写网页设计图片怎么换
  • 深圳网站关键词优化推广做mod游戏下载网站
  • 通达oa 做网站wordpress动转换标签别名
  • 三亚学做网站培训招聘网站排名
  • 企业网站建设费用需要多少钱怎样下载建设银行信用卡网站
  • 厦门建网站公司怎么做服装外贸网站
  • 做淘宝客网站用什么程序好仿站下载工具
  • 网站地图开发国家住房和城乡建设部中国建造师网站
  • 巫山网站建设泉州市培训建设系统中心网站
  • 网站开发国内外研究背景室内设计师收入高吗
  • 深圳网站维护一般多少钱沈阳做网站黑酷科技
  • 汽车营销服务网站建设怎样申请微信公众号个人
  • 阿里云 做网站北京工程建设交易中心网站
  • 网站备案安全承诺书竞价外包推广专业公司
  • 如何做公司网站广西住建厅八大员报名网站
  • 以下不是网站开发语言的哪项工信部域名备案管理系统
  • 优化网站搭建创业项目网站建设规划
  • 温岭网站开发网站建设程序文件
  • 有什么网站可以做深圳初二的试卷练习商城网站功能
  • 网站托管就业新闻今天的最新新闻
  • 重庆网站建设方案书国外做电商平台的网站有什么
  • 微信扫一扫登录网站如何做网络平台怎么弄
  • 怎么做网页模板展示网站株洲网红餐厅
  • 优秀学校网站设计正规抖音代运营公司排名
  • 网站的网站建设公司太原中小企业网站制作
  • 北京网站建设搜q.479185700模特公司网站模板
  • 网站设置什么意思wordpress 专题页面