Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //119
- #include <cstdio>
- char bits[16];
- int main(void) {
- FILE* fin = fopen("input.txt", "r");
- FILE* fout = fopen("output.txt", "w");
- int n, cnt = 0;
- fscanf(fin, "%d", &n);
- fclose(fin);
- if (n == 0) {
- fprintf(fout, "0\n");
- fclose(fout);
- return 0;
- }
- for (; n != 0; ++ cnt, n >>= 1) {
- if (n % 2 == 0)
- bits[14 - cnt] = 0x30;
- else
- bits[14 - cnt] = 0x31;
- }
- fprintf(fout, "%s\n", bits + 15 - cnt);
- fclose(fout);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement