my answer is 4 in this case. Is it right?helloneo wrote:Code: Select all
1 0 0 9 9 2 0 9 9 2 1 0 9 9 9 0 9 9
Search found 4 matches
- Tue Jun 06, 2006 4:58 am
- Forum: Volume 100 (10000-10099)
- Topic: 10067 - Playing with Wheels
- Replies: 62
- Views: 35802
- Sat Apr 08, 2006 6:16 am
- Forum: C++
- Topic: I don't know why this got CE.
- Replies: 7
- Views: 3496
Re: I don't know why this got CE.
#include <iostream>
bool isprime(int n){
if(n == 0 || n == 1) return true;
for(int i=2; i<n/2; i++){
if(n % i == 0)
return false;
}
return true;
}
BTW: are you sure you want isprime() to work this way? According to it 0 and 1 are prime, so is 4. I don't think you'll get AC with that.
you ...
bool isprime(int n){
if(n == 0 || n == 1) return true;
for(int i=2; i<n/2; i++){
if(n % i == 0)
return false;
}
return true;
}
BTW: are you sure you want isprime() to work this way? According to it 0 and 1 are prime, so is 4. I don't think you'll get AC with that.
you ...
- Fri Apr 07, 2006 6:35 pm
- Forum: C++
- Topic: I don't know why this got CE.
- Replies: 7
- Views: 3496
- Fri Apr 07, 2006 2:03 pm
- Forum: C++
- Topic: I don't know why this got CE.
- Replies: 7
- Views: 3496
I don't know why this got CE.
This go well on my machine, but I got CE. Why?
Code: Select all
deleted..