Cod sursa(job #1938146)
| Utilizator | Data | 24 martie 2017 17:40:24 | |
|---|---|---|---|
| Problema | Divizori Primi | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | alianta_001 | Marime | 0.74 kb |
#include <iostream>
#include <fstream>
using namespace std;
int t,n,k,h,dv1,dv2,dvp,x,y,aux,i;
ifstream fin("");
ofstream fout("");
int main()
{
cin >> t;
for (i=1;i<=t;i++)
{
cin >> n >> k;
for (h=n;h>0;h--)
{
dvp = 0;
for (x=2;x<h;x++)
{
if (h%x==0)
{
dv2 = 0;
for (y=2;y<x;y++) {if(x%y==0){y=x;dv2++;}}
if (dv2==0) {dvp = dvp+1;}
}
}
if (dvp==k)
{
aux = h;
h = -1;
}
}
if (h==0) {aux = 0;}
cout << aux << "\n";
}
return 0;
}
