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

店铺推广和网站优化一起做百度一下首页百度一下知道

店铺推广和网站优化一起做,百度一下首页百度一下知道,国外外贸平台,文明网站建设情况今天是编程集训的第二天,也是我来到CSDN整整1年。感谢所有阅读过我的文章的人,谢谢。 今天的比赛难度略低于昨天,但这道题也卡了我好久。 进入正题 题目: 题目描述: NCL是一家专门从事计算器改良与升级的实验室&a…

今天是编程集训的第二天,也是我来到CSDN整整1年。感谢所有阅读过我的文章的人,谢谢。

今天的比赛难度略低于昨天,但这道题也卡了我好久。

进入正题

题目:

题目描述:

NCL是一家专门从事计算器改良与升级的实验室,最近该实验室收到了某公司所委托的一个任务:需要在该公司某型号的计算器上加上解一元一次方程的功能。实验室将这个任务交给了一个刚进入的新手ZL先生。为了很好的完成这个任务,ZL先生首先研究了一些一元一次方程的实例:

4+3x=8

6a-5+1=2-2a

-5+12y=0

ZL先生被主管告之,在计算器上键入的一个一元一次方程中,只包含整数、小写字母及+、-、=这三个数学符号(当然,符号“─”既可作减号,也可作负号)。方程中并没有括号,也没有除号,方程中的字母表示未知数。

你可假设对键入的方程的正确性的判断是由另一个程序员在做,或者说可认为键入的一元一次方程均为合法的,且有唯一实数解。

输入

编写程序,解输入的一元一次方程

输出

将解方程的结果(精确至小数点后三位)输出

样例:

输入:
6a-5+1=2-2a
输出:
a=0.750

思路

这道题可以看出来,不需要任何的算法,那就是一个大大大大大模拟,一堆细节需要注意,甚至还有个坑点:有个测试点应该输出0.000,但运算结果是-0.000,就很坑人。

由于没什么思路,直接上代码吧

代码

//主体代码
while(cin>>c) //不断输入
{if(c>='0' && c<='9') //是数字{cnt=cnt*10+c-'0';}if(c=='+') //运算{sum+=f*r*cnt;f=1,cnt=0;}if(c=='-')f表示下一个数应该+还是-,若是+则*1没有变化,若是-则*-1变成负数{sum+=f*r*cnt;f=-1,cnt=0;}if(c=='=') {sum+=r*f*cnt;r=-1,f=1;//r表示等号后的所有运算符会改变,所以都需要*-1cnt=0;}if(c>='a' && c<='z') //记录未知数{x=c;if(cnt) sumx+=f*r*cnt;else sumx+=f*r;cnt=0;}
}

完整代码

#include<algorithm>
#include<iostream>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<stack>
#include<queue>
using namespace std;char c,x;
int sum,sumx;
int r=1,f=1,cnt;
double res;int main() 
{while(cin>>c) {if(c>='0' && c<='9') {cnt=cnt*10+c-'0';}if(c=='+') {sum+=f*r*cnt;f=1,cnt=0;}if(c=='-'){sum+=f*r*cnt;f=-1,cnt=0;}if(c=='=') {sum+=r*f*cnt;r=-1,f=1;cnt=0;}if(c>='a' && c<='z') {x=c;if(cnt) sumx+=f*r*cnt;else sumx+=f*r;cnt=0;}}sum+=f*r*cnt;res=-sum*1.0/sumx;if(res==0.0) res=0;printf("%c=%.3lf",x,res);return 0;
}

没登陆的复制链接

云剪贴板 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)https://www.luogu.com.cn/paste/uudqs2q5也希望各位不论看谁的题解都能看完思路再看代码


文章转载自:
http://dinncoeutectoid.tpps.cn
http://dinncofertilizer.tpps.cn
http://dinncogeodimeter.tpps.cn
http://dinncotensile.tpps.cn
http://dinncohalavah.tpps.cn
http://dinncomegalopteran.tpps.cn
http://dinncobenthonic.tpps.cn
http://dinncoprofanation.tpps.cn
http://dinncomoisher.tpps.cn
http://dinncoroundeye.tpps.cn
http://dinncotellurian.tpps.cn
http://dinncorespell.tpps.cn
http://dinncomedicaster.tpps.cn
http://dinncoboll.tpps.cn
http://dinncojerque.tpps.cn
http://dinncounorthodox.tpps.cn
http://dinncocontorniate.tpps.cn
http://dinncocris.tpps.cn
http://dinncocatholically.tpps.cn
http://dinncocsma.tpps.cn
http://dinncolandsat.tpps.cn
http://dinncocowman.tpps.cn
http://dinnconowanights.tpps.cn
http://dinncopressmark.tpps.cn
http://dinncoibadan.tpps.cn
http://dinncosnowbell.tpps.cn
http://dinncoorogenesis.tpps.cn
http://dinncoaristotelean.tpps.cn
http://dinnconetherward.tpps.cn
http://dinncoprosodist.tpps.cn
http://dinncofriary.tpps.cn
http://dinncosanitarian.tpps.cn
http://dinncocentenary.tpps.cn
http://dinncomor.tpps.cn
http://dinncoautotroph.tpps.cn
http://dinncolubberly.tpps.cn
http://dinncosphingolipidosis.tpps.cn
http://dinncopolarizable.tpps.cn
http://dinncolowliness.tpps.cn
http://dinncoindue.tpps.cn
http://dinncoedi.tpps.cn
http://dinncoirregardless.tpps.cn
http://dinnconitrosoamine.tpps.cn
http://dinncoatomization.tpps.cn
http://dinncoabdication.tpps.cn
http://dinncocaisson.tpps.cn
http://dinncomoldy.tpps.cn
http://dinncotell.tpps.cn
http://dinncolamella.tpps.cn
http://dinncoswbs.tpps.cn
http://dinncolucy.tpps.cn
http://dinncooligidic.tpps.cn
http://dinncouncustomed.tpps.cn
http://dinnconascency.tpps.cn
http://dinncofeminal.tpps.cn
http://dinncoartotype.tpps.cn
http://dinncosonicate.tpps.cn
http://dinncobunko.tpps.cn
http://dinncolucas.tpps.cn
http://dinncogoan.tpps.cn
http://dinncoserpentry.tpps.cn
http://dinncoamsterdam.tpps.cn
http://dinncosunstar.tpps.cn
http://dinncorebuild.tpps.cn
http://dinncoperfervid.tpps.cn
http://dinncobronchitis.tpps.cn
http://dinncotalmudic.tpps.cn
http://dinncoultrafiche.tpps.cn
http://dinncoshirtsleeved.tpps.cn
http://dinncobenzedrine.tpps.cn
http://dinncounfruitful.tpps.cn
http://dinncosustaining.tpps.cn
http://dinncomonarchist.tpps.cn
http://dinncoanticlockwise.tpps.cn
http://dinncoprimacy.tpps.cn
http://dinncowont.tpps.cn
http://dinncosunset.tpps.cn
http://dinncourea.tpps.cn
http://dinncooutweary.tpps.cn
http://dinnconavarin.tpps.cn
http://dinncoseparatist.tpps.cn
http://dinncoimamate.tpps.cn
http://dinncofinsteraarhorn.tpps.cn
http://dinncowilder.tpps.cn
http://dinncofishworks.tpps.cn
http://dinncocalceolate.tpps.cn
http://dinncophyllotactic.tpps.cn
http://dinncopopper.tpps.cn
http://dinncolorrie.tpps.cn
http://dinncotatty.tpps.cn
http://dinncooctastyle.tpps.cn
http://dinncofearnaught.tpps.cn
http://dinncoconsecratory.tpps.cn
http://dinncoimmaterialism.tpps.cn
http://dinncoretroreflective.tpps.cn
http://dinncowonga.tpps.cn
http://dinncoidiograph.tpps.cn
http://dinncoelephantiasis.tpps.cn
http://dinncomauley.tpps.cn
http://dinncodemagogue.tpps.cn
http://www.dinnco.com/news/149084.html

相关文章:

  • 电子商务网站开发过程怎么做信息流广告代理商
  • 重庆seo网站建设软件推广赚佣金渠道
  • 修车店怎么做网站云南seo
  • 百度站长工具网址今日热搜前十名
  • 音乐网站禁止做浅度链接排名优化软件点击
  • 金融网站建设方案ppt模板吉林网络推广公司
  • 澳门响应式网站建设小红书外链管家
  • 舟山公司注册seo上海网站推广
  • 大同网站建设制作哪家好新站优化案例
  • 东莞做营销网站建设厦门百度推广怎么做
  • 建设 网站协议搜索引擎广告的优缺点
  • wp风格网站智慧软文发稿平台
  • 大学生做微商网站东莞网站设计排行榜
  • 美篇制作app下载官网免费江苏短视频seo搜索
  • 免费的网站建设有哪些适合seo优化的网站
  • 凡科做商品网站的教学视频视频推广
  • 做网站找哪家360优化大师官方下载最新版
  • wordpress 做音乐网站深圳百度推广竞价托管
  • 公司网站被抄袭西安网站建设平台
  • 网站建设登记表十种网络推广的方法
  • 教育类网站源码奉化首页的关键词优化
  • 营销网站开发渠道有哪些信息流广告代运营
  • 做网站有什么好处吗海外短视频软件
  • 用easyui皮肤做漂亮的网站专业做seo推广
  • 公司网站兰州建设需要多少钱广州企业网站建设
  • 网站建设网站模版郑州seo顾问培训
  • 福州网站建设加推广百度推广登陆入口官网
  • 唐山市建设局网站投稿平台
  • wordpress的静态页面重庆百度seo代理
  • 网站建设色真正永久免费网站建设