Untitled
user_0483151
plain_text
a year ago
824 B
18
Indexable
#include <bits/stdc++.h>
#define endl '\n'
#define maxn 1005
#define TASK bai1
#define For(i,a,b) for ( int i = a; i <= b; i++ )
#define Ford(i,a,b) for ( int i = a; i >= b; i-- )
#define MOD 10000000
using namespace std;
string n ;
string Ret(string x) {
string y = "" ;
Ford(i,x.size()-1,0) y += x[i] ;
return y;
}
string Mi(string x) {
if ( x == Ret(x)) return x;
long long a = stoll(x) + stoll(Ret(x)) ;
x = to_string(a) ;
return Mi(x) ;
}
void inp() {
cin >> n;
}
void solve() {
long long a = stoll(n) + stoll(Ret(n)) ;
n = to_string(a) ;
cout << Mi(n) ;
}
int main()
{
ios_base:: sync_with_stdio(0);
cin.tie(0);
if(fopen("bai1.inp","r")){
freopen("bai1.inp","r",stdin);
}
inp();
solve() ;
}
Editor is loading...
Leave a Comment