F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_27966347_22957.cpp: In function 'int main()':
0_0_27966347_22957.cpp:20:119: error: expected '}' at end of input
  * @param n 合数,取值范围 [6, 10000000) */void  printGoldbach(bool* primes, int n);int main(void ) { bool primes[LEN];  // 素数集, 标记每个自然数是否为素数 findPrimes(primes);  // 找出范围内所有素数 int n = 0; while(cin >> n && n > 0) {  printGoldbach(primes, n); // 打印哥德巴赫猜想的结果 } return 0;}void  findPrimes(bool* primes) { memset(primes, true, sizeof(bool) * LEN); // 注意memset是按字节覆写内存的 primes[0] = primes[1] = false; for(int i = 2; i <= SQRT_NUM; i++) {  if(primes[i] == false) {   continue;  }  // 筛掉最小素数的所有倍数  int multiple = 2; // i的倍率(因不包括自身, 从2倍开始)   while(true) {   int mNum = i * multiple; // i的倍数   if(mNum >= LEN) {    break;   }   primes[mNum] = false;   multiple++;  } }}void  printGoldbach(bool* primes, int n) { int x, y = 0; for(x = 3; x < n; x++) {  if(primes[x] == false) {   continue;  }  if(primes[n - x] == true) {   y = n - x;   break;  } } if(x > 0 && y > 0) {  cout << n << " = " << x << " + " << y << endl; } else {  cout << "Goldbach's conjecture is wrong." << endl; }}
                                                                                                                       ^


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 08:12:02, Gzip enabled