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

Something strange...
Posted by Vukasin 23 Apr 2009 18:28
When i write my program like:
#include<cstdio>
long long int i,k;
int main(){

scanf("%lld",&k);
i=k / 3;
while(k % i!=0){
i=k /(k / i +1);
}

i got AC,but when i change it to:

#include<cstdio>

int main(){
long long int i,k;
scanf("%lld",&k);
i=k / 3;
while(k % i!=0){
i=k /(k / i +1);
}
printf("%lld",(k / i-1));
}

printf("%lld",(k / i-1));
}
i got WA5...does anyoe know how is that possible?
Re: Something strange...
Posted by nikita 20 Jun 2009 17:04
wtf i=k / 3; ??

If k%(l+1)==0 then 2nd have a chance to win.
And 1st wins if k%(l+1)!=0

try it: for (l=3;k%l!=0;l++);;
Re: Something strange...
Posted by Ionkin M [Samara SAU #617] 31 Mar 2017 14:16


Edited by author 31.03.2017 14:34