Monday, November 13, 2017

Puppy and Sum Codechef Problem Solution


https://www.codechef.com/problems/PPSUM

In C++.....................

    #include<bits/stdc++.h>

    using namespace std;

    int main()

    {

        int t,d,n,s;

         cin>>t;

         while(t--)

         {
             cin>>d>>n;
             long long  ans=n;
             while(d--)
             {

                  ans=((ans*(ans+1))/2);

             }
             cout<<ans<<endl;
         }
       return 0;
    }

No comments:

Post a Comment