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 925 (Div. 3) 1931D. Divisible Pairs Solution

    Problem Link  :   https://codeforces.com/contest/1931/problem/D S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. ...

Powered by Blogger.