nowcoder_2022年愚人节比赛_I 如何计算一个很大的次幂这个方法我们已经有所了解_stringstream

//
#include<bits/stdc++.h>
using namespace std;

void f( int x )
{
	double a=(double)(x+1)/x;
	printf("%.3lf\n",pow( a,x ) );
}

int main()
{
	string s;
	stringstream ss;
	int x;
	
    while( cin>>s )
    {
        if( s.size()>4 ) { f(11111); continue; } 
        
		ss.clear(); ss.str(""); 		// 注意清空 

        ss<<s; ss>>x; f(x);
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_63173957/article/details/123907783
今日推荐