| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 10826 | Prime |
|
Description
Given a sequence of range, you need to count the number of prime numbers in the each of range. Note that "1" is not the prime number.
Note that
1. This problem involves three files.
- function.h: Function definition of numPrime.
- function.cpp: Function describe of numPrime.
- main.cpp: A driver program to test your implementation.
You will be provided with main.cpp and function.h, and asked to implement function.cpp.
2. For OJ submission:
Step 1. Submit only your function.cpp into the submission block. (Please choose c++ 11 compiler)
Step 2. Check the results and debug your program if necessary.
function.h
#ifndef FUNCTION_H
#define FUNCTION_H
int numPrime(int start, int end);
#endif
main.cpp
#include <stdio.h>
#include "function.h"
int main(){
int start, end;
while(scanf("%d %d", &start, &end)!=EOF){
printf("%d\n", numPrime(start, end));
}
return 0;
}
Input
A sequence of range pair S, E, where 1<=S<=E<=10000000
Output
A sequence of integer representing the number of prime numbers in each range.