|
|
вернуться в форумTemplate for a testing. C++ /* * You should only define the SURC_TEST macros * in the compile directives! */ #include <stdio.h> void main(void) { int nT, a, b, nResult; #ifndef SURC_TEST scanf ("%d", &nT); #else nT = 27; #endif for (int iT = 0; iT < nT; ++iT) { #ifndef SURC_TEST scanf ("%d %d", &a, &b); #else switch (iT) { case 0: a = 30; b = 89; break; case 1: a = 2; b = 16; break; case 2: a = 3; b = 243; break; case 3: a = 1; b = 1; break; case 4: a = 2; b = 2; break; case 5: a = 2; b = 72; break; case 6: a = 1; b = 536870912; break; case 7: a = 1; b = 536870912; break; case 8: a = 1; b = 214358881; break; case 9: a = 1; b = 147008443; break; case 10: a = 1; b = 352275361; break; case 11: a = 1; b = 28934443; break; case 12: a = 1; b = 214921799; break; case 13: a = 1; b = 1042441; break; case 14: a = 1; b = 2627641; break; case 15: a = 1; b = 6086089; break; case 16: a = 1; b = 12823561; break; case 17: a = 1; b = 24730729; break; case 18: a = 1; b = 44930209; break; case 19: a = 1; b = 77810041; break; case 20: a = 1; b = 129254161; break; case 21: a = 1; b = 207561649; break; case 22: a = 1; b = 319730161; break; case 23: a = 1; b = 480091921; break; case 24: a = 1; b = 707081281; break; case 25: a = 1; b = 31973; break; case 26: a = 1; b = 499999999; break; default: a = 1; b = 1; break; } #endif nResult = 0; /********** ALGORITM START ******** * Insert your algorithm here. * input: a, b * result write to: nResult */ // ********* ALGIROTM END ********* #ifndef SURC_TEST printf ("%d\n", nResult); #else int nRightResult; switch (iT) { case 0: nRightResult = 0; break; case 1: nRightResult = 4; break; case 2: nRightResult = 5; break; case 3: case 4: nRightResult = 1; break; case 5: nRightResult = 5; break; case 6: case 7: nRightResult = 30; break; case 8: nRightResult = 9; break; case 9: nRightResult = 6; break; case 10: nRightResult = 5; break; case 11: case 12: nRightResult = 4; break; case 13: case 14: case 15: case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 24: nRightResult = 3; break; case 25: nRightResult = 2; break; case 26: nRightResult = 3; break; default: nRightResult = 1; break; } if (nResult == nRightResult) printf ("%d\tT\n", iT); else printf ("%d\tF: %d (should be: %d)\n", iT, nResult, nRightResult); #endif } } Edited by author 09.02.2013 22:15 Edited by author 09.02.2013 22:15 |
|
|