Cod sursa(job #2480087)

Utilizator MatteoalexandruMatteo Verzotti Matteoalexandru Data 24 octombrie 2019 21:15:32
Problema Cifra Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 1.49 kb
/*
                `-/oo+/-   ``
              .oyhhhhhhyo.`od
             +hhhhyyoooos. h/
            +hhyso++oosy- /s
           .yoooossyyo:``-y`
            ..----.` ``.-/+:.`
                   `````..-::/.
                  `..```.-::///`
                 `-.....--::::/:
                `.......--::////:
               `...`....---:::://:
             `......``..--:::::///:`
            `---.......--:::::////+/`
            ----------::::::/::///++:
            ----:---:::::///////////:`
            .----::::::////////////:-`
            `----::::::::::/::::::::-
             `.-----:::::::::::::::-
               ...----:::::::::/:-`
                 `.---::/+osss+:`
                   ``.:://///-.
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cmath>

using namespace std;

const int INF = 2e9;

char v[105] = {"0152839287784738415445962736211281728598893061706556251629322374051409906950637667184958433403940710"};
char s[105];

int main()
{
    freopen("cifra.in", "r", stdin);
    freopen("cifra.out", "w", stdout);
    int t;
    char ch;
    scanf("%d ", &t);
    while(t--){
        fgets(s, 102, stdin);
        int n = strlen(s) - 1;
        int nr;
        if(n >= 2) nr = (s[n - 2] - '0') * 10 + (s[n - 1] - '0');
        else nr = s[0] - '0';
        printf("%c\n", v[nr]);
    }
    return 0;
}