Thursday, July 20, 2017

1001. Reverse Root Timus Problem Solution & Logic

http://acm.timus.ru/problem.aspx?space=1&num=1001

অনেক সোজা একটা প্রোবলেম , শুধু দেয়া সংখ্যার বর্গমূল করতে হবে ও দশমিকের পর চার ঘর অবদি প্রকাশ করতে হবে , চলো কোড দেখি -

#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iomanip>

using namespace std;

//Nayeem Mollick Joy ,Applied Physics & Electronic Engineering ,University of Rajshahi.

int main()

{
    vector<double> v;

    double n;

    while(cin>>n) v.push_back(n);

    for(int i=v.size()-1;i>=0;i--) cout<<setprecision(4)<<fixed<<sqrt(v[i])<<endl;

    return 0;
}

3 comments:

  1. vi run korle output dekhai na..r
    fixed er use ta ki??

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Fixed is used for setting the precision after the decimal point. In this case it is set to 4 digit decimal point. After the whole number. For example - if output is 3.14159265 then it will show as (after fixed to 4 digit) - 3.1416

    ReplyDelete