File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 223223 languages = (LANG_C ),
224224 checks = [CheckOverallScore (100 , 100 )]),
225225
226+ # Rewrite input in the solution.
227+
228+ Test ('rewrite-input' ,
229+ task = batch_fileio_managed , filename = 'rewrite-input.%l' ,
230+ languages = (LANG_C ,),
231+ checks = [CheckOverallScore (0 , 100 )]),
232+
226233]
Original file line number Diff line number Diff line change 1+ #include <stdio.h>
2+
3+ /*
4+ * This returns the wrong result, but overwrites the input file so
5+ * that a wrong result appears as a correct one. CMS is expected not
6+ * to be fooled by this cheat attempt.
7+ *
8+ * CMS can counter this attack by making input.txt not writable or by
9+ * rewriting it again before calling the checker. Both things should
10+ * happen at the moment. This test is here to check that at least one
11+ * is functional.
12+ */
13+
14+ int userfunc (int x ) {
15+ FILE * fin = fopen ("input.txt" , "w" );
16+ fprintf (fin , "%d\n" , x + 1 );
17+ fclose (fin );
18+ return x + 1 ;
19+ }
You can’t perform that action at this time.
0 commit comments