'Mod' Challenge

User avatar
m!nus
Posts: 202
Joined: Sat Jul 28, 2007 6:49 pm
Location: Germany

Post by m!nus »

what's the point of quoting that?...

mod challenges have become too easy wwith the division fix

btw: my php HVM works fine and has quite a few command line options
General_Payne
Posts: 20
Joined: Mon Jun 20, 2011 6:25 pm

Mod/Fast Mod

Post by General_Payne »

Well, after struggling with Mod and the 10000 cycle limit i then realized the obvious easy solution.

Kind of made Fast Mod a case of copy paste.
User avatar
Isaev
Posts: 39
Joined: Tue Dec 16, 2008 11:23 pm
Location: Germany

Post by Isaev »

Expected: '1', got: '' for input '13,3'
Expected: '4', got: '' for input '34,6'
Expected: '96', got: '' for input '1566,294'
Expected: '9', got: '' for input '1799139,10'
2 test(s) passed
.... is incorrect.

How two?

Code: Select all

#include <stdio.h>
#include <string.h>

main()
{
    printf("n=%d\n", 13 % 3);
    printf("n=%d\n", 34 % 6);
    printf("n=%d\n", 1566 % 294);
    printf("n=%d\n", 1799139 % 10);  
}
n=1
n=4
n=96
n=9
Last edited by Isaev on Wed Jul 24, 2013 6:28 am, edited 1 time in total.
User avatar
CodeX
Posts: 350
Joined: Fri Oct 17, 2008 5:28 pm

Post by CodeX »

Assuming that was with code that prints nothing out: it's because an empty string is assumed to be 0 by PHP's casting so happens to be interpreted as correct by the test script. As far as I recall all the VM test scripts don't print out the input/output for any tests passed and even some 'secret' tests failed so 6 tests have been done but you only see 4.
User avatar
Isaev
Posts: 39
Joined: Tue Dec 16, 2008 11:23 pm
Location: Germany

Post by Isaev »

Ah... passed is incorrect? also two of six is incorrect? then everything clearly. I thought it's differently.
Post Reply