864 - EECS_I2P(I)2015_Chen_Lab6 Scoreboard

Time

2015/11/11 08:30:00 2015/11/11 09:50:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
10826 Prime

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.

Sample Input  Download

Sample Output  Download

Partial Judge Code

10826.cpp

Partial Judge Header

10826.h

Tags




Discuss