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

my solve-pascal
Posted by gyz113 14 Feb 2008 18:07
easy problem,but you must make some changes
Var k,i:longint;
Begin
 readln(k);
 i:=3;
 while k mod i>0 do inc(i);
 writeln(i-1);
End.
Re: my solve-pascal
Posted by Nickolas Kakà 6 Apr 2008 20:05
Won't you get TLE?
Re: my solve-pascal
Posted by XXX 26 Jan 2009 03:14
Once upon a time people invented the game named Bashi. +1 for gyz113. It is realy very easy problem.

my solve-C++:

#include "iostream"
using namespace std;
int main()
{
    int K, L = 0, i;
    cin >> K;
    for (i = 2; i <= K; i++)
        if ((K % (i+1)) == 0)
        {
            cout << i;
            return 0;
        }
    cout << "0";
    return 0;
}

sorry for my English.