Cod sursa(job #2074978)

Utilizator 980346Andreea 980346 Data 25 noiembrie 2017 10:28:16
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("prim.in");
ofstream g("prim.out");

long long d,N, x=3;
int k, nr=1, ok;

int main()
{
    f >> k;
    while(nr<(k)) {
        ok=1;
        for(d=2;d*d<=x; d++)
            if(k%d==0) ok=0;
            if(ok==1) nr++;x=x+2;



    }
    N=x*x;
    g << N; f.close();g.close();
    return 0;
}