hiho week 96 register

Ended

Participants:673

Verdict:Accepted
Score:100 / 100
Submitted:2016-05-04 15:08:16

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
23
24
25
26
27
28
29
30
31
#include<iostream>
using namespace std;
int euler(int n);
int main()
{
    int i,L,R,K;
    cin>>L>>R;
    K=L;
    for(i=L;i<2*L&&i<=R;i++)
    {
        if(euler(K)>euler(i))
        K=i;
    }
    cout<<K;
    return 0;
}
int euler(int n)
{
    int x=n, a=n;
    for(int i=2;i*i<=a;i++)
    {
        if(a%i==0)
        {
            x=x/i*(i-1);
            while(a%i==0)
            a/=i;
        }
    }
    if(a>1)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX