I am having a NZEC runtime error in greedy puppy, and it happens in only one of the sub-task…weird I wonder, why, I double checked my code to make sure such thing wouldn’t happen, division by 0, and stuffs like that
and I even tried to just copy-pasted one of the successful solution ( well not really, I just translated it to another language, from C to Dlang ), weird
import std.stdio;
void main(string[] args) {
uint testCases;
readf( "%u\n", &testCases );
while( testCases-- > 0 )
{
ulong nCoins, nHuman, maxCoins = 0;
readf( "%u %u\n", &nCoins, &nHuman );
for( int i = 2; i <= nHuman; ++i )
if ( nCoins % i > maxCoins ) maxCoins = nCoins % i;
writeln( maxCoins );
}
}