ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1014. Product of Digits

Where is my problem ?!?!
Posted by Rosen 22 Mar 2011 01:39
Finally I`ve made it! It works properly,but when I submit it-Compilation error ...


#include<iostream>
#include<math.h>
using namespace std;

int main ()
{
    int p;
    cin>>p;
     for(int i=1;i<=sqrt(p);i++)
     {if(p%i==0 && p/i!=p) {cout<<i<<p/i<<" ";}
     if(p%i==1) return -1;}
     system("pause");
}
Re: Where is my problem ?!?!
Posted by David Tvildiani[Tbilisi SU] 16 Jun 2011 22:53
for(int i=1;i<=sqrt(p);i++)

see definition of sqrt :
http://www.cplusplus.com/reference/clibrary/cmath/sqrt/


you can not pass sqrt int value ;
you must pass it double fload long long and ect.... but not int;

instead use This method  :

for(int i=1;  i*i<=p  ;i++)

:)

Edited by author 16.06.2011 22:54