Last active
November 20, 2017 16:43
-
-
Save likecs/ad044924fe0a419b3e771a5088ddbc4a to your computer and use it in GitHub Desktop.
Model Solution of GEEK02
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
int main() { | |
ios_base::sync_with_stdio(false); | |
int t, n; | |
cin >> t; | |
assert(1 <= t && t <= 100); | |
while(t--) { | |
cin >> n; | |
assert(0 <= n && n <= 10000); | |
if (n == 0) { | |
cout << "0\n"; | |
continue; | |
} | |
if (n % 9 != 0) { | |
cout << (n % 9); | |
} | |
for(int i = 1; i <= (n/9); ++i) { | |
cout << "9"; | |
} | |
for(int i = 1; i <= n; ++i) { | |
cout << "0"; | |
} | |
cout << "\n"; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment