[HDU] [2051] Bitset

Problem Description

Loading...

Problem Analysis

Base conversion
10→2

Here, by calling a function
an array is omitted

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#include<stdio.h>
void pr(int n) {
	if(n) {
		pr(n/2);
		printf("%d",n%2);
	} else
		return;
}
int main() {
	int n;
	while(scanf("%d",&n)!=EOF) {
		pr(n);
		printf("\n");
	}
	return 0;
}

Problem link:【杭电】[2051]Bitset

This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...