牛客网PAT练兵场-科学计数法
题目地址: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练兵场-科学计数法的更多相关文章
- 牛客网PAT练兵场-旧键盘打字
题目地址:https://www.nowcoder.com/pat/6/problem/4059 题解:用数组下标标记,直接模拟 /** * *作者:Ycute *时间:2019-12-01-21.3 ...
- 牛客网PAT练兵场-人口普查
题目地址:https://www.nowcoder.com/pat/6/problem/4054 题解:结构体排序即可 /** * Copyright(c) * All rights reserved ...
- 牛客网PAT练兵场-完美数列
题目地址:https://www.nowcoder.com/pat/6/problem/4056 题解:先将a数组进行排序,第一次按题意M<=n*p;n=a[0]时,M最大为J(如下图),然后n ...
- 牛客网PAT练兵场-打印沙漏
题目地址:https://www.nowcoder.com/pat/6/problem/4053 题意:模拟题 /** * Copyright(c) * All rights reserved. * ...
- 牛客网PAT练兵场-在霍格沃茨找零钱
题目地址:https://www.nowcoder.com/pat/6/problem/4063 题意:按照题目的进制计算即可 /** * *作者:Ycute *时间:2019-11-14-21.45 ...
- 牛客网PAT练兵场-福尔摩斯的约会
题目地址:https://www.nowcoder.com/pat/6/problem/4040 题意:模拟题,循环找相同的字母,但是注意题目的坑 /** * *作者:Ycute *时间:2019-1 ...
- 牛客网PAT练兵场-A除B
题目地址:https://www.nowcoder.com/pat/6/problem/4043 题解:遍历大数,边除边输出,最后得到余数输出即可 /** * *作者:Ycute *时间:2019-1 ...
- 牛客网PAT练兵场-锤子剪刀布
题目地址:https://www.nowcoder.com/questionTerminal/79db907555c24b15a9c73f7f7d0e2471 题解:无 /** * *作者:Ycute ...
- 牛客网PAT练兵场-跟奥巴马一起编程
题目地址: 题意:无 /** * *作者:Ycute *时间:2019-11-14-21.29.07 *题目题意简单描述:模拟题输出 */ #include<iostream> #incl ...
随机推荐
- 【工具】 - BeanUtils增强篇
public class BeanPlusUtils extends BeanUtils { public static <S, T> List<T> copyListProp ...
- 什么是Hexo博客
Hexo 是一个基于nodejs 的静态博客网站生成器,作者是来自台湾的Tommy Chen. 特点: 不可思议的快速 ─ 只要一眨眼静态文件即生成完成 支持 Markdown 仅需一道指令即可部署到 ...
- Python basestring() 函数
描述 basestring() 方法是 str 和 unicode 的超类(父类),也是抽象类,每组词 www.cgewang.com 因此不能被调用和实例化,但可以被用来判断一个对象是否为 str ...
- PHP zip_entry_open() 函数
定义和用法 zip_entry_open() 函数打开一个 zip 档案以供读取.高佣联盟 www.cgewang.com 如果成功,该函数则返回 TRUE.如果失败,则返回 FALSE. 语法 zi ...
- PHP str_word_count() 函数
实例 计算字符串 "Hello World!" 中的单词数: <?php高佣联盟 www.cgewang.comecho str_word_count("Hello ...
- RabbitMQ学习总结(2)-API的使用
1. 引用依赖 <dependency> <groupId>com.rabbitmq</groupId> <artifactId>amqp-clie ...
- 属性集 Properties
5.1 概述 java.util.Properties 继承于 Hashtable ,来表示一个持久的属性集.它使用键值结构存储数据,每个键及其对应值都是一个字符串.该类也被许多Java类使用,比如获 ...
- SSH安全免密码登录:ssh key
ssh key 使用非对称加密方式生成公钥和私钥 私钥存放在本地~/.ssh目录 公钥可以对外公开,放在服务器的~/.ssh/authorized_keys 1.linux平台生成ssh key ss ...
- Java中的引用与ThreadLocal
Java中的引用--强软弱虚 强引用 Object object = new Object(),这个object就是一个强引用.如果一个对象具有强引用,那就类似于必不可少的生活用品,垃圾回收器绝不会回 ...
- java Eclipse刷新报错 Feature 'taglib' not found.
刷新工程报错:org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'taglib' not found. 错误原因:tomcat7, ...