Untitled
unknown
plain_text
23 days ago
724 B
3
Indexable
Never
#include <bits/stdc++.h> #define endl '\n' #define maxn 105 #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 100000000000007 using namespace std; int d = 0,n; int Sum(int x) { int res = 0; while(x > 0) { res += x % 10; x /= 10; } return res; } void inp() { cin >> n; } void solve() { while(d <= 81) { d++; if(Sum(n - d) + n - d == n) break; } cout << n - d; } int main() { ios_base:: sync_with_stdio(0); cin.tie(0); if(fopen("bai1.inp","r")){ freopen("bai1.inp","r",stdin); } inp(); solve(); }
Leave a Comment