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 1023. Buttons

Isn't this simple code correct??? Or L in my solution is not minimal?
Posted by Osama Ben Laden 12 Feb 2002 23:44
#include <fstream.h>
#include <math.h>

int main()
{
 long k, q=1;
 cin>>k;
 for(long i=2; i<k; i++)
  if(k%i==1) {cout<<i<<'\n'; q=0; break;}
 if(q) cout<<"0\n";
 return 0;
}