Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define pc(x) putchar_unlocked(x);
- inline void writeInt (int n)
- {
- int N = n, rev, count = 0;
- rev = N;
- if (N == 0) {
- pc('0');
- pc('n');
- return;
- }
- while ((rev % 10) == 0) {
- count++;
- rev /= 10;
- //obtain the count of the number of 0s
- }
- rev = 0;
- while (N != 0) {
- rev = (rev<<3) + (rev<<1) + N % 10;
- N /= 10;
- //store reverse of N in rev
- }
- while (rev != 0) {
- pc(rev % 10 + '0');
- rev /= 10;
- }
- while (count--) pc('0');
- pc('n'); //this line prints new line and the reason for 1 second delay!
- }
- setvbuf(stdout, NULL, _IOFBF, 0);
- fflush(stdout);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement