Codeforces Round #797 (Div. 3) 1690A. Print a Pedestal (Codeforces logo?) Solution


 

Problem Link: https://codeforces.com/contest/1690/problem/A

Solution in C++:

///La ilaha illellahu muhammadur rasulullah
///******Bismillahir-Rahmanir-Rahim******///
///Abul Hasnat  Tonmoy
///Department of CSE,23rd batch
///Islamic University,Bangladesh
///**********ALLAH IS ALMIGHTY************///
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        double n,x,y,z,a;
        cin>>n;
        a=ceil(n/3);
        x=a;
        y=a+1;
        z=n-(x+y);
        if(z==0)
        {
            cout<<x-1<<" "<<y<<" "<<z+1<<endl;
        }
        else
            cout<<x<<" "<<y<<" "<<z<<endl;

    }
}









No comments

Most View Post

Recent post

Codeforces Round 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

  Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h &g...

Powered by Blogger.