CodeForces 697B Barnicle 和 Codeforce 691 C Puzzles 科学计数法的正逆互推 CodeForces 691B 一个对称的小题;

SoulX-FlashHead 加速实践,提升3倍。 阅读详情

Codeforce 697B Barnicle 题目链接, click here.
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
Barney is standing in a bar and starring at a pretty girl. He wants to shoot her with his heart arrow but he needs to know the distance between him and the girl to make his shot accurate.

这里写图片描述

Barney asked the bar tender Carl about this distance value, but Carl was so busy talking to the customers so he wrote the distance value (it’s a real number) on a napkin. The problem is that he wrote it in scientific notation. The scientific notation of some real number x is the notation of form AeB, where A is a real number and B is an integer and x = A × 10B is true. In our case A is between 0 and 9 and B is non-negative.
Barney doesn’t know anything about scientific notation (as well as anything scientific at all). So he asked you to tell him the distance value in usual decimal representation with minimal number of digits after the decimal point (and no decimal point if it is an integer). See the output format for better understanding.

Input
The first and only line of input contains a single string of form a.deb where a, d and b are integers and e is usual character ‘e’ (0 ≤ a ≤ 9, 0 ≤ d < 10100, 0 ≤ b ≤ 100) — the scientific notation of the desired distance value.
a and b contain no leading zeros and d contains no trailing zeros (but may be equal to 0). Also, b can not be non-zero if a is zero.

Output
Print the only real number x (the desired distance value) in the only line in its decimal notation.
Thus if x is an integer, print it’s integer value without decimal part and decimal point and without leading zeroes.
Otherwise print x in a form of p.q such that p is an integer that have no leading zeroes (but may be equal to zero), and q is an integer that have no trailing zeroes (and may not be equal to zero).

Examples

input
8.549e2
output
854.9

input
8.549e3
output
8549

input
0.33e0
output
0.33

题意:给一个科学计数法的数,让你转化为十进制的数.
注意:题目中Input中加粗的部分是需要注意的.
1> b,d没有后导零;
2> a如果等于0,b一定等于0;
#include<stdio.h>
#include<string>
#include<string.h>
using namespace std;
int main()
{
    char s[200];
    memset(s,0,sizeof(0));
    scanf("%s",s);
    int zero_d=0,dd=0;
    int l=strlen(s), a , num[109] , b=0;

    int e;//记录e的位置;

    a=s[0]-'0';//a;
    for(int i=2; i<l; i++)
    {
        if(s[i]=='e')
        {
            e=i;
            break;
        }
        if(s[i]=='0')
            zero_d++;//0的个数;
        else
            dd++;//不是0的个数;
    }
    int f=1;
    for(int i=l-1; i>e; i--)
    {
        b+=(s[i]-'0')*f;//b
        f*=10;
    }

    if(a==0&&b==0)//a,b都是0的情况;
    {
        if(zero_d==e-2)//d中全是0;
            printf("0");
        else
            for(int i=0; i<e; i++)
                printf("%c",s[i]);
    }
    else if(b==0&&a!=0)//b是0,a不是0;
    {
        if(zero_d==e-2)//d 全是0;
            printf("%d",a);
        else
        {
            for(int i=0; i<e; i++)
                printf("%c",s[i]);
        }
    }
    else if(a!=0&&b!=0)//同时不为0;
    {
        if(e-2<b)//b超过d的长度;
        {
            b-=e-2;//b代表的是此时d的长度;
            printf("%d",a);
            for(int i=2; i<e; i++)
                printf("%c",s[i]);
            for(int i=1; i<=b; i++)
                printf("0");
        }
        else
        {
            printf("%d",a);
            for(int i=2; i<=b+1; i++)
                printf("%c",s[i]);
            if(e-2!=b)//d的长度不等于b要求向后推的长度;
            {
                printf(".");
                for(int i=b+2; i<e; i++)
                    printf("%c",s[i]);
            }
        }
    }
    return 0;
}

Codeforce 691 C Exponential notation,题目链接, click here!!!
Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u

Submit

Status

Practice

CodeForces 691C

Description

You are given a positive decimal number x.

Your task is to convert it to the “simple exponential notation”.

Let x = a·10b, where 1 ≤ a < 10, then in general case the “simple exponential notation” looks like “aEb”. If b equals to zero, the part “Eb” should be skipped. If a is an integer, it should be written without decimal point. Also there should not be extra zeroes in a and b.

Input

The only line contains the positive decimal number x. The length of the line will not exceed 106. Note that you are given too large number, so you can’t use standard built-in data types “float”, “double” and other.

Output

Print the only line — the “simple exponential notation” of the given number x.

Sample Input

Input
16

Output
1.6E1

Input
01.23400

Output
1.234

Input
.100

Output
1E-1

Input
100.

Output
1E2
题意很简单,但是状态有点多...明天写…粘上代码先…

#include<bits/stdc++.h>
using namespace std;
const int maxn = 1000000;
char s[maxn];
int main()
{
    scanf("%s",s);
    int l=strlen(s),point=-1;
    int a=0,b=l,ans=0;

    //get rid of leading zeros and trailing zeros ;

    for(int i=0; i<l; i++)
        if(s[i]!='0'&&s[i]!='.')
        {
            a=i;
            break;
        }
    for(int i=l-1; i>=0; i--)
        if(s[i]!='0'&&s[i]!='.')
        {
            b=i;
            break;
        }
    for(int i=0; i<l; i++)
        if(s[i]=='.')
        {
            point=i;
            break;
        }
//printf("point   %d,,a %d, ,,b %d\n",point ,a,b);
    if(point==-1)  //indicate that the numb is integer;
    {
        printf("%c",s[a]);
        if(a!=b)
        {
            printf(".");
            for(int i=a+1; i<=b; i++)
                printf("%c", s[i]);
            printf("E%d",l-a-1);
        }
        else
        {
            if(l!=a+1)
                printf("E%d",l-a-1);
        }
    }
    else if(point==0)
    {
        printf("%c",s[a]);
        if(a!=b)
            printf(".");
        for(int i=a+1; i<=b; i++)
            printf("%c",s[i]);
        printf("E-%d",a);
    }
    else
    {
        printf("%c",s[a]);
        if(point>a)
        {
            if(b<point)//如果 b 在point 的左边;
            {
                if(a==b)
                {
                    if((point-a-1))
                        printf("E%d",point-a-1);
                }
                else
                {
                    printf(".");
                    for(int i=a+1; i<=b; i++ )
                        printf("%c",s[i]);
                    printf("E%d",point-a-1);
                }
            }
            else
            {
                printf(".");
                for(int i=a+1; i<=b; i++)
                    if(s[i]!='.')
                        printf("%c",s[i]);
                if((point-a)!=1)
                    printf("E%d",point-a-1);
            }
        }
        else
        {
            if(a!=b)
                printf(".");
            for(int i=a+1; i<=b; i++)
                printf("%c",s[i]);
            printf("E-%d",a-point);
        }
    }
    return 0;
}

CodeForces 691B Puzzles 题目链接, click here!!!!!!!!

这里写图片描述
这个图中,能够左右对称的有15个,包括以下:
A,H,I,M,T,Y,U, O,o,V,v,W,w,X,x;(m不算)
能够左右对称的有两组:p和q, b和d;
这样一来就好做了...

#include<bits/stdc++.h>
using namespace std;
const int maxn = 1008;
char s[maxn];
int main()
{
    scanf("%s",s);
    int l=strlen(s);
    char str[20];
    str[0]='A';
    str[1]='H';
    str[2]='v';
    str[3]='I';
    str[4]='M';
    str[5]='O';
    str[6]='o';
    str[7]='T';
    str[8]='U';
    str[9]='V';
    str[10]='W';
    str[11]='w';
    str[12]='X';
    str[13]='x';
    str[14]='Y';
    int ll=0;
    for(int i=0,j=l-1; i<l/2; i++,j--)
    {
        if(s[i]==s[j])
        {
            for(int k=0; k<15; k++)
                if(s[i]==str[k])
                {
                    ll+=2;
                    break;
                }
        }
        else if((s[i]=='b'&&s[j]=='d')||(s[j]=='b'&&s[i]=='d')||(s[i]=='p'&&s[j]=='q')||(s[j]=='p'&&s[i]=='q'))
            ll+=2;
        else
            break;
    }
    if(l%2==0&&ll==l)
        printf("TAK\n");
    else
    {
        for(int i=0; i<15; i++)
            if(s[l/2]==str[i])
            {
                ll+=1;
                break;
            }
        if(ll==l)
            printf("TAK\n");
        else
            printf("NIE\n");
    }
    return 0;
}
2026华为OD面试题084:贪心的商人 商人经营一家店铺,有 `number` 种商品。由于仓库限制,每件商品的最大持有数量是 `item[index]`。 每种商品每天有一个价格 `item_price[item_index][day]`。通过对商品买进和卖出获取利润,请给出商人在 `days` 天内能获取到的最大利润。 注:同一件商品可以反复买进和卖出。 输入描述: - 第一行输入商品数量 `number` - 第二行输入商人售货天数 `days` - 第三行输入 `number` 个整数,表示每件商品的最大持有数量 `item[in 阅读详情

相关推荐

论文阅读《Eigen-GNN: A Graph Structure Preserving Plug-in for GNNs》

好久没看论文了,感觉好生疏 关于这篇文章的大致脉络,这篇文章已经介绍过了。

且视他人之疑目如盏盏鬼火,大胆地去走你的夜路 461

【CodeForces】691C - Exponential notation

http://codeforces.com/problemset/problem/691/C给定一个长度为N的数字,转化为 标准的科学计数法形式。 N最大可达1e6。要考虑前置0 和 后置 0 的特殊情况。 当指数为0 的时候,不输出指数部分。 x=0; x∈(0,1),这种情况下指数部分为-1; x 为整数,这种情况主要是处理不存在小数点的情况,其他情况输入都肯定包含小数点的; x∈

西瓜不甜的博客 314

【鼠标在不点击的情况下,直接移动到QT控件上不显示提示信息】

有时明明已经调用了setToolTips方法,鼠标移动到QT控件上仍然不会有提示信息,这时候就需要具体分析下。重点就是标红的这段话,大概意思就是。.h文件中加入鼠标移动事件的定义。.cpp文件中实现该事件。

ZTH_G的博客 2423

Codeforces-697B-Barnicle(模拟)

A - Barnicle Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u SubmitStatusPracticeCodeForces 697B Description Barney is standing in a bar and starring at a pretty girl.

Prim 727

【Allegro学习笔记】常规标贴封装创建-0402封装创建实例

摘要 本文主要介绍如何使用Allegro制作表面贴装封装。 所使用的软件 使用Allegro制作常规贴片封装主要使用的软件有Pad Designer和Allegro 1 0402类封装制作 1.1 0402类封装焊盘分析 0402封装尺寸图如图1...

Honglong 1万+

数学建模小白必看:层次分析法(AHP)从入门到实战(附Python代码)

本文详细介绍了层次分析法(AHP)在数学建模竞赛中的应用,从构建判断矩阵到一致性检验,再到权重计算和实战案例。通过Python代码实现,帮助小白快速掌握AHP的核心技巧,解决评价类难题,提升建模效率。

web39explorer的博客 918

CodeForces 697 B. Barnicle(简单模拟)

Description 给出一个形如a.bed的数,表示a.b*10^d,输出其小数形式 Input 一个形如a.bed形式的字符串(0 ≤ a ≤ 9, 0 ≤ d < 10^100, 0 ≤ b ≤ 100) (a,b无前置0,d无后缀0) Output 输出小数形式 Sample Input 8.549e2 Sample Output 854.9 Solution 简单

ZSQ 693

MoveIt避障规划实战:从点云到OctoMap的环境感知全流程

本文详细解析了MoveIt避障规划中从点云到OctoMap的环境感知全流程,重点介绍了深度相机选型、点云数据处理、OctoMap生成及避障规划参数调优等关键技术。通过实战案例展示了如何利用MoveIt和OctoMap实现机械臂在复杂环境中的高效避障,为工业自动化和服务机器人开发提供实用解决方案。

weixin_30417487的博客 569

Codeforces 697B Barnicle

B. Barnicle time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Barney is standing in a bar and starring at a pretty girl. He wants to shoot he

Jane_JXR的博客 831

AI测试干货:Claude Code Skill 从入门到精通

本文介绍了Claude Code Skill功能如何解决AI重复工作问题。传统提示词方式需要人工复制粘贴,而Skill功能通过建立AI工作记忆库实现智能触发和分层加载。Skill包含工作指令、文档和资源,能自动执行任务。文章以API测试用例生成为例,展示了Skill的创建流程和结构化设计,包括测试框架、覆盖场景和输出格式,显著提升测试工程师的工作效率。

blues_C的博客 2439

把 SAP 配置当成一张地图:用 IMG 把实施、变更与治理串成一条清晰的路

摘要 SAP IMG(Implementation Guide)是SAP实施的核心导航体系,它将客户需求转化为系统配置,提供结构化路径和文档化支持。IMG不是简单的菜单树,而是包含业务落地路径、标准化配置活动和文档化知识的实施语言。通过三种视图(Reference、Enterprise、Project)解决不同管理问题,其中Project IMG尤其重要,可管理项目范围、分工和进度。实际工作中应通过SPRO事务码访问IMG,将探索与执行分开管理。案例显示,跨国企业通过Project IMG可有效控制组织架构

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 229

Codeforces697B Barnicle 模拟

Barney is standing in a bar and starring at a pretty girl. He wants to shoot her with his heart arrow but he needs to know the distance between him and the girl to make his shot accurate. Barney

Megumin的博客 824

看懂特斯拉IMU底层逻辑,才懂农业机器人不可替代的核心技术壁垒

在自动驾驶与具身智能赛道,特斯拉彻底重构了IMU(惯性测量单元)的技术定位,打破行业“IMU仅为辅助补盲配件”的固有认知,将其从底盘附属硬件升级为纯视觉感知体系的物理核心基座。依托500–1000Hz超高刷新率、无外部依赖的惯性感知能力、端到端神经网络融合架构,特斯拉实现了“视觉感知环境、IMU定义运动”的技术闭环,摆脱对激光雷达、高精地图、卫星定位的强依赖。这套技术逻辑落地农业机器人赛道,不再是技术优化,而是规模化落地的生存刚需。城市自动驾驶属于结构化稳定场景,IMU仅作误差修正的锦上添花;

getusushu的博客 49

CodeForces - 697B Barnicle (高精度小数点)

竞赛题目 CodeForces-697B 题解

WolfBolin技术博客 690

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

Codeforces 697B. Barnicle(模拟)

题目链接简单题意把科学计数法转化成小数。思路字符串处理模拟就好,要小心谨慎,当时被疯狂hack T^T要注意的数据 1.0e0 0.0e0 1.005e0 0.0e10 这种#s = input() a = s[0] d = s[2:s.find('e')] b = int(s[s.find('e') + 1:]) + 1 a = a + d while len(a) < b: a +=

我为刀俎_题为鱼肉 749

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

A. Combination Lock

Scrooge McDuck keeps his most treasured savings in a home safe with a combination lock. Each time he wants to put there the treasures that he’s earned fair and square, he has to open the lock. The com...

风中追风的博客 584

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

CodeForces 697B

B. Barnicle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Barney is standing in a bar and starring at a pretty girl.

algzjh的博客 773

Codeforces Round #480 (Div. 2) B - Marlin 对称构造

题意:4*n (n为奇数)的矩形格子上面见商店,只能在2*(n-2)的内部建造,使得左上角到右下角和左下角到右上角的“最短路径条数相等”;思路:“最短路径条数相等”,因为只能上下左右移动,所以一个只能往右或下移动,一个只能往右或上移动;我们大致可以想到构造上下对称的局面,使得两个人所 都能经过同样的点;多推一下可以发现有几种情况:m为偶数,直接上下对称两部分m为奇数,可以“一”和“凹”两种情况;#...

床前明月光 232

科学计数法还原成实数 CodeForces - 697B(分类讨论)

题目:巴尼站在酒吧里盯着一个漂亮的女孩。 他想用他的爱情之箭射击她,但他需要知道他和女孩之间的距离,使他射击准确。巴尼问了酒保卡尔这个距离的具体数值,但卡尔正忙着和客户交谈,所以他在餐巾纸上写了距离值(这是一个真正的数字)。 问题是他以科学计数法写下来。 他将实数 x 表示成了 AeB的形式,其中 A 是一个实数而 B 是一个整数,并且 x = A × 10B 。在这里 A 的值在 0 到 9 之...

笑彪夕的博客 1664

codeforce 697B Barnicle

题目大意:输入一个科学计数法表示的数字,这个数字没有前导0,形如:a.deb  (0 ≤ a ≤ 9, 0 ≤ d 100, 0 ≤ b ≤ 100)。要求输出正常的表示方法,格式要求如果是整数则不能有小数点。 http://codeforces.com/problemset/problem/697/B #include #include using namespace std; int nu

chen_minghui的博客 406

CodeForces - 697B

这道题看见就觉得是道水题,想着随便写写就能A了,然后就开始上手直接模拟,然后就被数据打脸了。 后面就困了一个多小时,各种改,最后还是看了题解发现了scanf的多种用法。 题目大概意思就是说:         给一个 a.bec格式的数,让你转化。 a是正整数,b是小数,ec是10的c次方。 就是转化 a.b*10的c次方 下面给代码。 #include<iostream...

weixin_34390996的博客 162

nyoj 1234 签到题,一个很简单的数学题;

签到题 nyoj 1234 ,题目链接 click here签到题 时间限制:1000 ms | 内存限制:65535 KB 难度:2 描述 hrw最近看到一个有趣的几何题,题目描述是这样的:一个大圆盘里面放入许多小圆盘,每个小圆盘必须接触大圆盘边缘且与其他小圆盘不能相交,但它们可以互相接触,每个小圆盘具有相同的半径,求此条件下能否放入n个小圆盘。输入 Multiple

不念过往 , 不愧恒心 1345

NYoj 1236 密室逃脱

挑战密室 时间限制:1000 ms | 内存限制:65535 KB 难度:4描述 R组织的特工Dr. Kong 为了寻找丢失的超体元素,不幸陷入WTO密室。Dr. Kong必须尽快找到解锁密码逃离,否则几分钟之后,WTO密室即将爆炸。Dr. Kong发现密室的墙上写了许多化学方程式中。化学方程式,也称为化学反应方程式,是用化学式表示物质化学反应的式子。化学方程式反映的是客观事实。因此书写化

不念过往 , 不愧恒心 1314

魔方系列——最小装箱

魔方系列——最小装箱 Time Limit: 1000msMemory Limit: 65536KB 64-bit integer IO format: %lld Java class name: Main Prev Submit Status Statistics Discuss Next DreamFox为了发展地大的魔方水平,经常会到世界盲拧记录保持者瓦西里处去进货一些魔方。

不念过往 , 不愧恒心 888

hdu 1716 排列2 (全排列)

题目链接 ,click here Problem DescriptionRay又对数字的列产生了兴趣: 现有四张卡片,用这四张卡片能排列出很多不同的4位数,要求按从小到大的顺序输出这些4位数。Input每组数据占一行,代表四张卡片上的数字(0<=数字<=9),如果四张卡片都是0,则输入结束。Output对每组卡片按从小到大的顺序输出所有能由这四张卡片组成的4

不念过往 , 不愧恒心 877

hdu 5806 NanoApe Loves Sequence Ⅱ 前缀和+尺取法

NanoApe Loves Sequence Ⅱ,原文链接,click here Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/131072 K (Java/Others) Total Submission(s): 596 Accepted Submission(s): 286Problem Descripti

不念过往 , 不愧恒心 871
上一篇: 线段树刷题指南(转载自网络)
下一篇: hdu 1042 大数阶乘 ,
落幕丶式
博客等级 码龄11年 2粉丝 45原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值