洛谷P2393题解

P2393 【yyy loves Maths II】

原题链接

  • 话说,这题其实方法对了,也蛮水的。

  • 首先方法是一样的,直接扩大忽略精度问题。

  • 其次,我用了c++的函数控制输出小数位数,方法:cout<
    注意,此函数包含在iomanip头文件中。

  • 因为我用的输入输出是C++的流式,所以加个取消同步就行了,(其实不加也行)(逃。

  • 然后,就没有然后了。


#include
#include
using namespace std;

double n,ans;

int main(void){
    ios::sync_with_stdio(false);

    while(cin>>n){ans+=n*1000000;}
    cout<

你可能感兴趣的:(洛谷题解)