hiho week 92 register

Ended

Participants:755

Verdict:Accepted
Score:100 / 100
Submitted:2016-04-09 21:07:03

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <cstdio>
#include <iostream>
using namespace std;
int n,ans;
bool a[1000001];
int main()
{
    cin>>n; 
    for(int i=2;i*i<=n;i++)
    {
        if(a[i]) continue;
        for(int j=2*i;j<=n;j+=i)
        {
            if(!a[j])
            {
                a[j]=1;
                ans++;
            }
        }
    }
    cout<<n-ans-1;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX