Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std ;
- #define sz(s) int(s.size())
- #define all(v) v.begin() , v.end()
- #define imin INT_MIN
- #define imax INT_MAX
- typedef long long ll ;
- void ABDEL3AL () {
- ios_base::sync_with_stdio(false); cin.tie(nullptr) , cout.tie(nullptr) ;
- #ifndef ONLINE_JUDGE
- freopen("input.txt" , "r" , stdin) , freopen("output.txt" , "w" , stdout) ;
- #endif
- }
- int main() {
- ABDEL3AL() ;
- int t ; cin >> t ;
- while (t--) {
- int x ; cin >> x ;
- int sum = 0 ;
- bool right = false ;
- for (int i = 1; i <= 70; i++) {
- while (i > 0) sum += i % 10 , i /= 10 ;
- if (sum == x) {
- cout << i ;
- right = true ;
- break ;
- }
- }
- cout << (right ? "\n" : "-1\n") ;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment