Cod sursa(job #2986380)

Utilizator slol003Rizea Alexandru-Gabriel slol003 Data 28 februarie 2023 14:52:47
Problema Invers Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 1.19 kb
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <bits/stdc++.h>

using namespace std;
ifstream fin("invers.in");
ofstream fout("invers.out");
int T, invers, sum, ca, cnt=0;
map <int,int> v[10005]
int main()
{
    fin>>T;
    for (int i=1; i<=T; ++i)
    {
        fin>>v[i];
    }
    for (int i=1; i<=T; ++i)
    {
        for (int j=1; j<=v[i];++j)
        {
            ca=j;
            while (j!=0)
            {
                invers=invers*10+(j%10)
                j/=10;
            }
            sum=ca+invers;
            invers=0;
            if (v[i]==sum)
            {
                fout>>"DA">>"\n";
                cnt++;
            }
        }
        if (cnt>=1)
        {
            continue;
        }
        if (cnt==0)
        {
            fout<<"NU"<<"\n";
        }
    }

    return 0;
}