Analyse the Pattern - SSEC0010

Problem Link: SSEC0010

Problem:

Given the following string pattern that is infinitely long, you are give a row number. The task for you is to print ASCII code of each alphabet of the given row.[All alphabets are capital].
S
S S
S S E
S S E C
S S E
S S
S
S
S S
S S E
S S E C
S S E …

###Input:

  • First line will contain TT, number of testcases. Then the testcases follow.
  • Each testcase contains of a single line of input,row number NN.

###Output:
For each row, print its corresponding set of ASCII codes.

###Constraints

  • 1≤T≤1001≤T≤100
  • 2≤N≤1092≤N≤109

###Sample Input:
2
5
4

###Sample Output:
83 83 69
83 83 69 67

###EXPLANATION:
Row 5: String: S S E
Corresponding ASCII Code: 83 83 69
Row 4: String: S S E C
Corresponding ASCII Code: 83 83 69 67

Solution:

#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll p=1e9+7;
ll power(ll x,ll y)
{
ll res = 1; // Initialize result

//x = x % p; // Update x if it is more than or
            // equal to p

//if (x == 0) return 0; // In case x is divisible by p;

while (y > 0)
{
    // If y is odd, multiply x with result
    if (y & 1)
        res = (res*x) % p;

    // y must be even now
    y = y>>1; // y = y/2
    x = (x*x) % p;
}
return res%p;

}
ll n=2000;
bool prime[2000];

void sieve()
{
memset(prime,true,sizeof(prime));
ll i,j;
for(i=2;ii<=2000;i++)
{
if(prime[i]==true)
{
for(j=i
i;j<=2000;j+=i)
{
prime[j]=false;
}
}
}
}
int main()
{
ll t=1;
cin>>t;
while(t–)
{
ll n;
cin>>n;
if((n-1)%7==0||n%7==0)
cout<<83<<endl;
else if((n-2)%7==0||(n-6)%7==0)
cout<<83<<" “<<83<<endl;
else if((n-3)%7==0||(n-5)%7==0)
cout<<83<<” “<<83<<” “<<69<<endl;
else if((n-4)%7==0)
cout<<83<<” “<<83<<” “<<69<<” "<<67<<endl;
}

}