题目地址:https://www.nowcoder.com/pat/6/problem/4050

题解:模拟题

 /**
* Copyright(c)
* All rights reserved.
* Author : Ycute
* Date : 2019-11-27-20.03.29
* Description : 无
*/
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
char str[];
bool flag1;
int p;
scanf("%s",str);
if(str[]=='-')printf("-");
int j=;
int num=;
while(){
if(str[j]=='E')break;
j++;
}//找到E的位置
bool flag=;
if(str[j+]=='+')flag=;
j=j+;
while(j<strlen(str)){
num=num*+str[j]-'';
j++;
}
// cout<<num<<endl;
//输出指数;
if(!flag){//向前走
if(num>){
printf("0.");
num--;
while(num--)printf("");
for(int i=;i<strlen(str);i++){
if(str[i]=='.')continue;
if(str[i]=='E')break;
printf("%c",str[i]);
}
}else{
for(int i=;i<strlen(str);i++){
if(str[i]=='E')break;
printf("%c",str[i]);
}
}
}else{//向后走
printf("%c",str[]);
for(int i=;i<strlen(str);i++){
if(!num)printf(".");
if(str[i]=='E')break;
printf("%c",str[i]);
num--;
}
if(num>){
while(num--)printf("");
}
}
return ;
} //-1.23400E+03

牛客网PAT练兵场-科学计数法的更多相关文章

  1. 牛客网PAT练兵场-旧键盘打字

    题目地址:https://www.nowcoder.com/pat/6/problem/4059 题解:用数组下标标记,直接模拟 /** * *作者:Ycute *时间:2019-12-01-21.3 ...

  2. 牛客网PAT练兵场-人口普查

    题目地址:https://www.nowcoder.com/pat/6/problem/4054 题解:结构体排序即可 /** * Copyright(c) * All rights reserved ...

  3. 牛客网PAT练兵场-完美数列

    题目地址:https://www.nowcoder.com/pat/6/problem/4056 题解:先将a数组进行排序,第一次按题意M<=n*p;n=a[0]时,M最大为J(如下图),然后n ...

  4. 牛客网PAT练兵场-打印沙漏

    题目地址:https://www.nowcoder.com/pat/6/problem/4053 题意:模拟题 /** * Copyright(c) * All rights reserved. * ...

  5. 牛客网PAT练兵场-在霍格沃茨找零钱

    题目地址:https://www.nowcoder.com/pat/6/problem/4063 题意:按照题目的进制计算即可 /** * *作者:Ycute *时间:2019-11-14-21.45 ...

  6. 牛客网PAT练兵场-福尔摩斯的约会

    题目地址:https://www.nowcoder.com/pat/6/problem/4040 题意:模拟题,循环找相同的字母,但是注意题目的坑 /** * *作者:Ycute *时间:2019-1 ...

  7. 牛客网PAT练兵场-A除B

    题目地址:https://www.nowcoder.com/pat/6/problem/4043 题解:遍历大数,边除边输出,最后得到余数输出即可 /** * *作者:Ycute *时间:2019-1 ...

  8. 牛客网PAT练兵场-锤子剪刀布

    题目地址:https://www.nowcoder.com/questionTerminal/79db907555c24b15a9c73f7f7d0e2471 题解:无 /** * *作者:Ycute ...

  9. 牛客网PAT练兵场-跟奥巴马一起编程

    题目地址: 题意:无 /** * *作者:Ycute *时间:2019-11-14-21.29.07 *题目题意简单描述:模拟题输出 */ #include<iostream> #incl ...

随机推荐

  1. Java线程池ThreadPoolExecutor面试总结思维导图速记

    优点 降低资源消耗,通过重复利用已创建的线程降低线程创建和销毁造成的消耗. 提高响应速度,当任务到达时,可以不需要等待线程创建就能立即执行. 提高线程的可管理性 类关系 接 Executor 一个无返 ...

  2. WEB应用中的路径问题及乱码问题

    1 WEB应用中的路径问题  在web应用中,由于使用转发跳转路径时,地址栏不变.此时使用相对路径(../)存在404现象. 故使用绝对路径,解决web应用的路径问题. 什么是绝对路径,以 “/” 开 ...

  3. python4.5实用内置模块

    #引入urllib百度网页的数据爬取 from urllib import request url="http://www.baidu.com"data=request.urlop ...

  4. synchronized 锁的原理

    synchronized 的基本认识 在多线程并发编程中 synchronized 一直是元老级角色,很 多人都会称呼它为重量级锁.但是,随着 Java SE 1.6 对 synchronized 进 ...

  5. Ubuntu用户都应该了解的快捷键

    无论我们使用什么操作系统还是什么软件,快捷键都是非常有用的,因为可以在启动应用程序或跳转到所需窗口,可以快速进行很多操作,而无需动鼠标到处点,节省时间和精力,提高效率. 就像在Windows中一样,U ...

  6. XCTF-WEB-高手进阶区-NaNNaNaNNaN-Batman-笔记

    上来直接百度先搜下Batman -_-|| 不存在的传令兵么 本身是下载下来了一个文件web100 打开发现是如下内容 可以看出这个是个脚本语言,因此尝试修改后缀为html,发现是一个OK框 现在是想 ...

  7. Java中的File类,递归是什么?

    一.IO概述 当需要把内存中的数据存储到持久化设备上这个动作称为输出(写)Output操作. 当把持久设备上的数据读取到内存中的这个动作称为输入(读)Input操作. 因此我们把这种输入和输出动作称为 ...

  8. springboot中使用定时器

    springboot使用注解注册定时器 @Configuration @EnableScheduling public class WeatherDataTask implements Schedul ...

  9. 2020-05-27:SpringCloud用了那些组件?分布式追踪链怎么做的?熔断器工作原理?

    福哥答案2020-05-27: SpringCloud分布式开发五大组件详解服务发现——Netflix Eureka客服端负载均衡——Netflix Ribbon断路器——Netflix Hystri ...

  10. cocos-2d解决rapidjson的string参数转换

    解决方法 AddMember的传入的参数不是string, 所以会报错 本质就是把string类型转换成 参数的类型 username = "string"; rapidjson: ...