---
# System prepended metadata

title: '***ZeroJudge***'

---

# ***ZeroJudge***
## 進位轉換
- [x] a132

###### 題目:https://zerojudge.tw/ShowProblem?problemid=a132

![](https://i.imgur.com/SdABaea.png)

```cpp=
#include  <bits/stdc++.h>
using namespace std;

string toBinary(int n)
{
    string r;
    while (n != 0)
	{
        r += ( n % 2 == 0 ? "0" : "1" );
        n /= 2;
    }
    return r;
}
int main()
{	
	int n,count;
	string x;
	while(cin >> n)
	{	
        if(n==0)
            break;
        x=toBinary(n);
		reverse(x.begin(),x.end());
		count=0;
		for(int i=0;i<toBinary(n).length();i++)
		{
			if(x[i]=='1')
			{
				count++;
			}
		}
		cout << "The parity of " << x <<" is " << count <<" (mod 2).\n"; 
	}	
	return 0;
}
```


###### 題目:https://zerojudge.tw/ShowProblem?problemid=e545
![](https://i.imgur.com/lzMndZU.png)

- [ ] e545
```cpp=
#include  <bits/stdc++.h>
using namespace std;

int main()
{	
	int t,n1,n2,b1,b2;
	cin >> t;
	while (t--)
	{
		cin >> n1, n2 = b2 = 0, b1 = n1;
		while (b1)
		{
			n2 = (n2 << 4) + b1 % 10, b1 /= 10;
		}
		
		while (n1)
		{
			b1 += n1 & 1, n1 >>= 1;
		}
		while (n2)
		{
			b2 += n2 & 1, n2 >>= 1;
		}
			
		cout << b1 << ' ' << b2 << '\n';
	
	}return 0;
}
```


## 動態建表

###### 題目:https://zerojudge.tw/ShowProblem?problemid=d261

![](https://i.imgur.com/vwiG1b3.png)

- [x] d261
```cpp=
#include <iostream>
using namespace std;
 
int main() 
{
	long long n,male,female,f;
	while(cin >> n)
	{
		male=0;
		female=1;
		if(n==-1)
		break;
		for(int i=1;i<=n;i++)
		{
			f=male;
			male+=female;
			female=f+1;
		}
		cout<<male<<" "<<female+male<<endl;
	}
	return 0;
}
```

```cpp=
//pp豬
#include <bits/stdc++.h>

using namespace std;

int main()
{
	int N; // 年分 // 
	while(cin >> N)
	{
		long long a, b, c, t; // a是大母蜂, b是公蜂, c小母蜂 // 
		for(i=0; i<=N; i++)
		{
			
		}
		if(N == -1)
			break;
		cout << a << " "<< b << endl;	
	}
	return 0;
} 
```