-
Total time limit:
-
1000ms
-
Memory Limit:
-
65536kB
-
-
Describe
-
-
Given an integer, invert the number on each bit to get a new number. The new number should also satisfy the common form of integers, that is, unless the given original number is zero, the maximum number of new numbers to be reversed should not be 0 (see Example 2).
-
-
Input
-
-
Enter a total of 1 rows, an integer n.
-1,000,000,000≤n≤1,000,000,000.
-
-
Output
-
-
outputs a total of 1 rows, an integer representing the new number after reversal.
-
-
Sample input
-
-
Example #1:123 Sample #2:380
-
-
Sample output
-
-
Example #1:321 Sample #2:83
-
-
Source
-
The
-
first problem of the popularization group of NOIP2011
-
#include <stdio.h>#include<string.h>intMain () {intlen=0, I; Chara[ -]; Gets (a); Len=strlen (a); inttop; Top=len-1; while(a[top]=='0') Top--; if(a[0]=='-') {printf ("-"); for(i=top;i>0; i--) printf ("%c", A[i]); } Else { for(i=top;i>=0; i--) printf ("%c", A[i]); }return 0;}
1-5-29: Digital Inversion