## 發表文章

(按一下播放)

### Q686: Goldbach's Conjecture(II)

//Q686 Goldbach's Conjecture(II)
//Accepted 2008-04-21 13:35:20
#include <iostream>
#include <cmath>

using namespace std;

int main(void)
{
int n = 0, nt;
while(cin >> n)
{
if (n == 0)
break;
int ct = 0, count = 0;
nt = n;
int *prime = new int [n];

//get prime
for(int i = 2; i <= nt; i++)
{
bool isprime = true;
for(int j = 2; j <= sqrt(i) && isprime; j++)
isprime = i % j != 0;
if (isprime)
prime[ct++] = i;
}

for(int i = 0; i < ct; i++)
{
int becheck = n - prime[i];
for(int j = 0; j < ct; j++)
if (becheck == prime[j] && prime[i] >= prime[j])
{
count++;
break;
}
}
cout << count << endl;
delete [] prime;
}
}

### Q445: Marvelous Mazes

//Q445 Marvelous Mazes
//Accepted 2008-04-20 11:51:13

#include <iostream>
#include <string>

using namespace std;

int main(void)
{
int repeat = 0;
string data;

while(getline(cin, data))
{
for(int i = 0; i < data.length(); i++)
{
if (data[i] >= '0' && data[i] <= '9')
{
repeat += data[i] - 48;
continue;
}

if (data[i] == 'b')
{
for(int j = 0; j < repeat; j++)
cout << " ";
repeat = 0;
}

if (data[i] == '!')
cout << "\n";
else
{
for(int j = 0; j < repeat; j++)
cout << data[i];
repeat = 0;
}
}
cout << endl…

### Q412: Pi

//Q412 Pi
//Accepted 2008-04-20 11:18:00
#include <iostream>
#include <iomanip>
#include <cmath>
#include <stdio.h>

using namespace std;

int gcd(int, int);

int p[32768];
int main(void)
{
int t = 0, n[50];
double pi, tt, bp = 0;

while(cin >> t)
{
bp = 0;
if (t == 0)
exit(0);
for(int i = 0; i < t; i++)
cin >> n[i];
for(int i = 2; i <= t; i++)
for(int j = 1; j <= i - 1; j++)
if (n[j - 1] > n[i - 1])
{
if (gcd(n[j - 1], n[i - 1]) == 1)
bp++;
}
else
{
if (gcd(n[i - 1], n[j - 1]) == 1)
bp++;
}

tt = t * (t - 1) / 2;
if (bp == 0)
cout << "No estimate for this data set." << endl;
else
{
pi = sqrt(tt * 6 / bp);
cout << setprecision(6…

### Q256: Quirksome Squares

//Q256 Quirksome Squares
//Accepted 2008-04-19 12:29:19
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main(void)
{
int n, c, k = 0;
while(cin >> n)
{
c = static_cast<int>(pow(10.0, n/2));
for (int i = 0; i < c * c - 1; i++)
if (((i % c) + (i / c)) * ((i % c) + (i / c)) == i)
cout << setw(n) << setfill('0') << i << endl;
}
return 0;
}

### 不能說的‧秘密 觀後感

(picture from wikipedia)

"Follow the notes upon the journey
At first sight marks one's destiny
Once the voyage comes to an end
Return lies within hasty keys"

(這是我後來上網看文章才知道的)

### "思"無窮遞回?

for(i = 0; i < ∞; i++)
cout << "思";

Evanescence - Going Under

Now I will tell you what I've done for you -
50 thousand tears I've cried.
Screaming, deceiving and bleeding for you -
And you still won't hear me.
(going under)
Don't want your hand this time - I'll save myself.
Maybe I'll wake up for once (wake up for once)
Not tormented daily defeated by you
Just when I thought I'd reached the bottom

I'm dying again

I'm going under (going under)
Drowning in you (drowning in you)
I'm falling forever (falling forever)
I've got to break through
I'm going under

Blurring and stirring - the truth and the lies.
(So I don't know what's real) So I don't know what's real and what's not (and what's not)
Always confusing the thoughts in my head
So I can't trust myself anymor…