当前位置:网站首页>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
边栏推荐
- Basic content learning of software testing (I)
- [untitled]
- 如何实现基于 RADIUS 协议的双因子认证 MFA?
- spark的资源调度和任务调度
- 当面试官让你用两种方式写BinarySort
- Common faults and solutions of Substation
- Understanding the IO model
- How do I open an account on my mobile phone? Is it safe to open an account online now?
- 用Pytorch搭建第一个神经网络且进行优化
- Which securities company is better and safer to choose when opening an account for the inter-bank certificate of deposit fund with mobile phone
猜你喜欢

Music website design based on harmonyos (portal page)

Implementation of code scanning login

Redis5.0 slot migration, free play (single machine migration cluster)

How to solve the problem of high concurrency and seckill

STL -- binder
![[untitled]](/img/bb/213f213c695795daecb81a4cf2adcd.jpg)
[untitled]

Discussion on the practice of fire emergency lighting system in the field of building electrical design
![[untitled]](/img/bb/213f213c695795daecb81a4cf2adcd.jpg)
[untitled]

Operating principle of Rogowski coil

Learn how Alibaba manages the data indicator system
随机推荐
用Pytorch搭建第一個神經網絡且進行優化
SQL injection file read / write
中金财富开户安全吗?怎么收费?
华泰证券网上开户安全吗 办理流程是什么
Matlab tips (20) matrix analysis -- principal component regression
JMeter -- interface test 1
手机炒股开户安不安全?
Chrome devtools
Avframe Memory Management API
Batch modify tables and sorting rules for fields in tables
Is it safe for Huatai Securities to open an account online? What is the handling process
两道面试小Demo
SQL注入之文件读写
Construire le premier réseau neuronal avec pytorch et optimiser
Key points of building fire protection design
Automatic conversion - interview questions
Power data
DEJA_ Vu3d - 052 of cesium feature set - Simulation of satellite orbit (high altitude) effect
电子元器件销售ERP管理系统哪个比较好?
DEJA_VU3D - Cesium功能集 之 051-地形开挖完美实现