ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1209. 1, 10, 100, 1000...

Correct Code
Posted by Nik4o 6 Jan 2022 20:46
0.031 time

#include <iostream>
#include <cmath>
#define ll long long

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    ll N;

    cin >> N;

    while (N--)
    {
        ll a;

        cin >> a;

        ll r = a - 1;
        ll k = sqrt(2 * r);

        if (k * (k + 1) / 2 == r)
        {
            cout << 1;
        }
        else
        {
            cout << 0;
        }

        cout << " ";
    }

    cout << endl;

    return 0;
}
Re: Correct Code
Posted by ivan 11 Feb 2022 15:03
a = int(input())
s = str()
i = 0
r = []
w = []
while i != 200:
    s = s + str(10**i)
    i = i+1
for i in range(a):
    q = int(input())
    r = s[0:q+1]
    print(r[-2:-1])