ADV-238-水分子数问题

本文介绍了一个简单的程序,该程序能够根据输入的水的夸脱数计算并输出水分子的总数。通过将夸脱数转换为克,再由水分子的质量计算得出分子数量。
一个水分子的质量是3.0*10-23克,一夸脱水的质量是950克。写一个程序输入水的夸脱数n(0 <= n <= 1e10),然后输出水分子的总数。
输入
  109.43
输出

  3.465283E+027


C

#include <stdio.h>

int main(){
	 float a;
	 scanf("%f",&a);
	 a =(a * 950)/(3.0*1e-23);
	 printf("%.6E",a);
	 return 0;
}

C++

#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <string>
#include <vector>
#include <ctime>
using namespace std;
const int MAX = 20;
const int Mod = 99999999;
#define inf 0x3f3f3f3f
#define lson l,mid,i<<1
#define rson mid+1,r,i<<1|1
typedef long long ll;

const double c = 3E-23;

int main()
{
//    freopen("C:/Users/lqy/Desktop/in.txt","r",stdin);
    double n;
    cin>>n;
    double res = n*950/c;
//    char str[256];
//    sprintf(str, "%lf", res);
//    cout<<str;
    printf("%E",res);
    return 0;
}





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值