০৯ সেপ্টেম্বর ২০১৬

Upcomming_Eid_Ul_AZHA_Programmming_Contest Problem B. Even Digits

Link: Problem B - Even Digits Problem Link
AC Code Link: Problem B - Even Digits AC Code Link

//#include<cstdio>
//#include<iostream>
//#include<algorithm>
//#include<vector>
//#include<cstring>
//#include<cmath>
//#include<map>
#include<bits/stdc++.h>
using namespace std;

#define fast ios_base::sync_with_stdio(false)
#define outs(x) cout << x << " "
#define outn(x) cout << x << "\n"
#define sf scanf
#define pf printf
#define high 10000

typedef long long LL;
typedef vector<int>vii;
typedef vector<LL>vll;

int main()
{
    fast;
    int t, tc=0;
    LL n, quotiant=0;
    string ans="";
    cin >> t;
    while(t--)
    {
        ans="";
        cin >> n;

        cout << "Case " << ++tc << ": ";

        if(n==1)
        {
            outn("0");
            continue;
        }

        quotiant = n-1;

        while(quotiant > 0)
        {
            ans+=((quotiant % 5) * 2) + 48;

            quotiant = quotiant / 5;
        }

        reverse(ans.begin(), ans.end());
        outn(ans);
    }

    return 0;
}

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন