ACM_求相邻最小素数

Describtion
胖胖斌的数学不太好,这天数学老师要让他在L和U(1<=L

#include 
using namespace std;
typedef long long ll;
const ll maxn = 100000;
ll prime[maxn], t = 0;
ll minc = 10000;
ll prime2[maxn], cnt = 0;
ll isprime[maxn];
ll L, P;
ll flag;
int loc=0;


void init()
{
    memset(isprime,0,sizeof(isprime));
    for(ll i=2;i=L)
                isprime[j-L]=1;
        }
    }
    if(L==1)
        isprime[0] = 1;
    for(int i=0;i<=P-L;i++)
    {
        if(!isprime[i])
            prime[++t] = i+L;
    }

}

int main()
{
//    freopen("data.in","r",stdin);
    init();
    while(cin>>L>>P)
    {
        loc = 0;
        minc = 10000;
        t = 0;
        solve();
//        for(int i = 0;i< t;i++)
//            cout< prime[i] - prime[i-1])
            {
                minc = prime[i] - prime[i-1];
                loc = i;
            }
        printf("%lld %lld\n",prime[loc-1],prime[loc]);
    }
//    system("pause");
    return 0;
}

你可能感兴趣的:(❥ACM学习)