Cod sursa(job #42009)

Utilizator bobo_2dan horia bobo_2 Data 28 martie 2007 19:55:30
Problema Next Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.29 kb
#include<fstream.h>

 long long n,r,m,a,s;

ifstream f("next.in");
ofstream g("next.out");

int main()
{    f>>n;
     f>>r;
	  while(n%r>0)
	     {n-=1;
	      s++;
	     }

       r=r-s;
       
       m=n+r+s;
	g<<m;


     g.close();
     f.close();
     return 0;
}