Cod sursa(job #1062276)
Utilizator | Data | 20 decembrie 2013 23:13:10 | |
---|---|---|---|
Problema | Next | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include<stdio.h>
using namespace std;
long long d,n,p;
int gasit,q;
int main()
{
FILE*f1;
FILE*f2;
f1=fopen("next.in","rb");
f2=fopen("next.out","wb");
fscanf(f1,"%lld",&n);
fscanf(f1,"%lld",&d);
if(n%d==0)fprintf(f2,"%lld",n);
else
{
q=n/d;
while(gasit==0)
{
p=d*q;
if((p>=n)&&(p%d==0))
gasit=1;
++q;
}
fprintf(f2,"%lld",p);
}
return 0;
}