当前位置:网站首页>P2394 yyy loves Chemistry I
P2394 yyy loves Chemistry I
2022-06-28 09:12:00 【A program ape who smashes the keyboard】
P2394 yyy loves Chemistry I
# yyy loves Chemistry I
## Background
Because I will eat the car back , So I put it in the title description ~
## Title Description
[ The story background ]
Once upon a time , There's a man named yyy, He especially likes chemistry , Especially some are very dangerous (zuo) risk (si) The experiment of .
[ Background ]
This day , He began to work out a magical and interesting equation
2Na + 2H2O ==== 2NaOH + H2↑
[ Problem description ]
Now? yyy The mass of a piece is xg Put a lot of sodium into the water , Then start collecting hydrogen .
Final , We know , later , The sodium disappeared in the water . and yyy A bad , All the hydrogen has been collected .
** Every known investment 23 Gram of sodium , Will generate 1 Grams of hydrogen .**
So now yyy How many grams of hydrogen are collected ?
## Input format
a line , A real number x, representative yyy How many grams of sodium are put into the water
The end of the input file line must be ** Can't ** One of them has returned ~
## Output format
a line , A real number ( Round to the nearest 8 Decimal place ), Represents how many grams of hydrogen are produced
## Examples #1
### The sample input #1
```
0.23
```
### Sample output #1
```
0.01000000
```
## Tips
[ Data scale ]
about 100% The data of ,0<x<=1
[ Tips ]
Do you want to know x Are there any decimals ? I won't give it to you >\_<
All I know is that the space limit is 4M, The time limit is 0.1s, And if you read all the numbers down, it might MLE Slightly ~
kkksc: No data range ! Input files do not exceed 5M!
The author : How can it be like this ! Bad review ! I can't dig a hole !
【 translate 】
Enter a
Dead manVery long real numbers x, Output x/23 Retain 8 A decimal value .
【AC Code 】
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<string>
#include<vector>
using namespace std;
long double x;
signed main()
{
scanf("%15Lf",&x);
cout<<fixed<<setprecision(8)<<x/23;
return 0;
}
learn Before Lesson , Before writing the code this time, I have done a good job of adjusting the accuracy Get ready .

【 High level practices 】
#include <iostream>
#include <cstdio>
using std::scanf;
using std::printf;
int x;
char c;
int len(int a) // The length of the returned number
{
if (a==0)
return 1;
int ans=0;
while (a)
{
++ans;
a/=10;
}
return ans;
}
int main()
{
if ((c=getchar())=='1') // Special judgement
{
long double y=1;
printf("%.8Lf", y/23);
return 0;
}
getchar();
bool flg=false;
for (int i=1; i<=9; ++i)
{
if (!flg)
c=getchar();
if (c>'9'||c<'0')
x*=10, flg=true;
else
x=(x<<3)+(x<<1)+c-'0';
}
x=(x/23+5)/10; // rounding
putchar('0');
putchar('.');
int length=len(x);
for (int i=1; i<=8-len(x); ++i) // Fill in the leading zero
putchar('0');
printf("%d\n", x);
return 0;
}
selected from Yingchuyin bucket rubber
Tarragon konjakA man( Tangled to play a man )Of TJ.Yuan Longping : The biggest mistake of my life is to let
Yingchuyin bucket rubberChinese people have nothing to do when they are full of food
边栏推荐
猜你喜欢

Installation of containerd1.5.5

Explain observer mode

new URL(“www.jjj.com“)

Privacy computing fat----- offline prediction

电子元器件销售ERP管理系统哪个比较好?

rman备份报ORA-19809 ORA-19804

Basic operation of PMP from applying for the exam to obtaining the certificate, a must see for understanding PMP

It only takes two steps to find the right PMP organization, one check and two questions

1182: group photo effect

数据挖掘建模实战
随机推荐
用Pytorch搭建第一个神经网络且进行优化
Characteristics and prevention of electrical fire
Ffmpeg streaming fails to update header with correct duration
APICloud携手三六零天御,助力企业守好App安全“第一关”
自动转换之-面试题
Play SFTP upload file
Using transform:scale causes the page mouse hover event to disappear
How to solve the problem of high concurrency and seckill
DEJA_VU3D - Cesium功能集 之 052-模拟卫星轨道(高空)效果
Webrtc advantages and module splitting
学习阿里如何进行数据指标体系的治理
How to suppress SiC MOSFET crosstalk?
图解MySQL的binlog、redo log和undo log
From knowledge to wisdom: how far will the knowledge map go?
Decision table method for basic content learning of software testing (2)
用Pytorch搭建第一個神經網絡且進行優化
104. maximum depth of binary tree
在本类私有属性直接使用?new()在使用!!!
spark的资源调度和任务调度
Deployment of MySQL database in Linux Environment