Top 20

1 0x00h 700 pts
2 boris39 700 pts
3 neoxquick 681 pts
4 maf-ia 662 pts
5 thefinder 644 pts
6 benito255 608 pts
7 mego 591 pts
8 madbat2 581 pts
9 Mart 553 pts
10 Stupefy 533 pts
11 nikokks 512 pts
12 tehron 504 pts
13 Kithyane 502 pts
14 plucth 480 pts
15 egosum 473 pts
16 CoYoTe99 416 pts
17 Undr 415 pts
18 Zeta 415 pts
19 loonies2 411 pts
20 Armavica 409 pts

Classement complet

Shoutbox

12 May - 11:47 am

Working again now.

10 May - 4:05 pm

Hello, sorry for the late answer, in fact yes there is an issue with the mail, we will try to fix it quickly. Thanks for reporting

7 May - 6:07 pm

Hi there is a issue for the challenfe Email (number 21). I don't receive a mail on any of them: gmail, hotmail, yahoo. do i fail or is it the challenge ?

28 Feb - 10:35 am

Yes we fixed it

27 Feb - 10:00 pm

Thank you, just validated contest22. The solution checker seems to have been fixed.

27 Feb - 8:40 am

Yes several solutions are accepted of course. I will check one of your answers

26 Feb - 7:51 pm

No 500 error, but the solutions I'm submitting can be verified to be correct. It can't be that only one configuration is accepted, right? - as there are multiple correct configurations for each problem.

26 Feb - 5:54 pm

contest 22 is not concerned by the issue I found, and seems to be working (I suppose you don't have 500 error on this one ?). Your solutions are indeed rejected, but I did not check them yet

26 Feb - 3:25 pm

The validation for contest 22 also seems to be wrong (it's not accepting solutions that are clearly correct). I submitted bug report yesterday.

26 Feb - 9:59 am

Ok I fixed the issue It is higly possible that other challenges are impacted, so don't hesitate to tell meif you encounter this again. Thank you for reporting

Connexion
Mot de passe oublié

Supportez nousx

Vous aimez µContest ?
Supportez nous en votant (fun et difficulté) pour µContest sur WeChall :)
Si vous ne l'avez pas encore fait, profitez-en pour lier votre compte
Wechall à µContest pour pouvoir voter !

Merci

Contents

µContest, what is it ? How to participate ? How to solve the challenges proposed ? What language ? You will find all the answers to theses questions in this page. Concerning more specific questions, you can ask them on the forum.

General

How to solve a challenge

The µContest libraries

Example of a challenge resolution I

Example of a challenge resolution II

Technical documentations

Library C/C++ documentation

General information

Current version : 2.1

The library contains functions that enable you

  • to check if the lib is up to date
  • to get the variable values of a challenge
  • to send back the answer(s) you found to the website
  • print formatted results
The particularity of the version 2 is that all the code is contained in 1 single file, microcontest2.h you should put in the same directory than your source file.
You just have to include the lib by doing :
#include "microcontest2.h"

Available functions

Here is a list of the functions you can use :

Function Prototype Description
- MC_CheckLibVersion - int MC_CheckLibVersion(int *pLibUpToDate) Checks if the lib is up to date
- MC_StartContest - int MC_StartContest(int ContestID, const char *pNickname, const char *pPassword) Gets the variables from the website
- MC_GetParam_int
- MC_GetParam_float
- MC_GetParam_char
- int MC_GetParam_int(const char *pVariableName, int *pVariable_int)
- int MC_GetParam_float(const char *pVariableName, float *pVariable_float)
- int MC_GetParam_char(const char *pVariableName, char **ppVariable_char, unsigned int *pLength)
Give you the variables downloaded by MC_StartContest
- MC_AddVariableToSolution_int
- MC_AddVariableToSolution_float
- MC_AddVariableToSolution_char
- int MC_AddVariableToSolution_int(const char *pVariableName, int Variable)
- int MC_AddVariableToSolution_float(const char *pVariableName, float Variable)
- int MC_AddVariableToSolution_char(const char *pVariableName, const char *pVariable, int Length)
Add answers to the final solution
- MC_SendSolution - int MC_SendSolution(MC_ResultStruct *pResult) Sends the final solution to the website
- MC_ResultMessage - char* MC_ResultMessage(MC_ResultStruct *pResult, int Print) Prints a summary of the results (success, points...)
- MC_ErrorMessage - char* MC_ErrorMessage(unsigned int ErrorCode, int Print) Prints a message associated with an error code

Available symbols

Here is a list of the error codes defined in microcontest2.h :

Error Code Value Description
MC_OK 0 No error.
MC_ERROR_VERSION 1 This version of the microcontest2 library does not work anymore. Please download the last one on www.microcontest.com/download.php.
MC_ERROR_CONNECTION 2 A connection problem happened.
MC_ERROR_IDENTITY 3 An authentification problem happened.
MC_ERROR_IDENTITY_UNKNOWNUSER 4 This username does not exist.
MC_ERROR_IDENTITY_NONACTIVATED 5 Your account has not been activated yet.
MC_ERROR_IDENTITY_PASSWORD 6 Wrong password.
MC_ERROR_MEMORY 7 A memory error happened.
MC_ERROR_FORMAT 8 The data sent by the server is not formatted properly.
MC_ERROR_UNKNOWN 9 An unknown error happened.
MC_ERROR_SERVER 10 The HTTP server has a problem or the microcontest2 library sent incorrectly formatted data.
MC_ERROR_BRUTEFORCE 11 Bruteforce error.
MC_ERROR_BADCTENCODING 12 The data sent by the server is not formatted properly (Bad Chuncked Transfer Encoding).

Available structures

typedef struct
{
	int success;
	int timeout;
	int already;
	int points;
	int error;
	char msg_error[1024];
} MC_ResultStruct;

MC_CheckLibVersion

Prototype / Description

int MC_CheckLibVersion(int *pLibUpToDate)

Enables you to check if the lib version if up to date.

Parameters

  • [out] int *pLibUpToDate : A pointer on a int variable that will receive 1 if the library is up to date, 0 otherwise.

Return value

  • [out] int : An error code (see here)

Example

int LibUpToDate = 0;
			
ErrorCode = MC_CheckLibVersion(&LibUpToDate);           
if(ErrorCode != MC_OK)
{
    MC_ErrorMessage(ErrorCode, 1);
    return 0;
}
else if(LibUpToDate == 0)
{
    printf("Warning: the version of the libmicrocontest2 is not the last one.\n");
    printf("Current version:\t%s\n", MC_LIBVERSION);
    printf("This program may not work properly. Consider downloading the latest version on\nthis page : http://www.microcontest.com/download.php\n\n");
}

MC_StartContest

Prototype / Description

int MC_StartContest(int ContestID, const char *pNickname, const char *pPassword)

Downloads new variable values from the website and store it. You need to use MC_GetParam_xxx to get them.

Parameters

  • [in] int ContestID : The ID of the contest you want to solve, written on every contest page.
  • [in] const char *pNickname : Your nickname
  • [in] const char *pPassword : Your password

Return value

  • [out] int : An error code (see here)

Example

ErrorCode = MC_StartContest(13, "Your nickname", "Your password");   // Challenge 13
if(ErrorCode != MC_OK)
{
	MC_ErrorMessage(ErrorCode, 1);
	return 0;
}

MC_GetParam_int

Prototype / Description

int MC_GetParam_int(const char *pVariableName, int *pVariable_int)

Once you called MC_StartContest, you can retrieve the int variables values with this function.

Parameters

  • [in] const char *pVariableName : The identificator string of the variable you want to retrieve written on every contest page.
  • [out] int *pVariable_int) : A pointer on a int variable that will receive the variable value.

Return value

  • [out] int : 1 if the function succeeded, 0 otherwise.

Example

int Nb1 = 0, Nb2 = 0;
			
ErrorCode = MC_GetParam_int("a", &Nb1);
ErrorCode *= MC_GetParam_int("b", &Nb2);
if(ErrorCode == 0)
{
	printf("Impossible to get the contest data. Please check the ID of the contest.\n");
	return 0;
}

MC_GetParam_float

Prototype / Description

int MC_GetParam_float(const char *pVariableName, float *pVariable_float)

Once you called MC_StartContest, you can retrieve the float variables values with this function.

Parameters

  • [in] const char *pVariableName : The identificator string of the variable you want to retrieve written on every contest page.
  • [out] float *pVariable_int) : A pointer on a float variable that will receive the variable value.

Return value

  • [out] int : 1 if the function succeeded, 0 otherwise.

Example

float Nb = 0;
			
ErrorCode = MC_GetParam_float("height", &Nb);
if(ErrorCode == 0)
{
	printf("Impossible to get the contest data. Please check the ID of the contest.\n");
	return 0;
}

MC_GetParam_char

Prototype / Description

int MC_GetParam_char(const char *pVariableName, char **ppVariable_char, unsigned int *pLength)

Once you called MC_StartContest, you can retrieve the string variables values with this function. Note that it is the library that allocates the memory for the strings and frees it automatically. You don't need to take care of that.

Parameters

  • [in] const char *pVariableName : The identificator string of the variable you want to retrieve written on every contest page.
  • [out] char **ppVariable_char : A pointer on a char* pointeur that will receive the adress of the string. You can use it as a regular buffer.
  • [out] unsigned int *pLength : A pointer on an unsigned int variable that will receive the length of the string.

Return value

  • [out] int : 1 if the function succeeded, 0 otherwise.

Example

char *pCryptedText = NULL;
unsigned int CryptedTextLength = 0;
int Key = 0;
			
ErrorCode = MC_GetParam_char("txt_crypte", &pCryptedText, &CryptedTextLength);
ErrorCode *= MC_GetParam_int("key", &Key);
if(ErrorCode == 0)
{
    printf("Impossible to get the contest data. Please check the ID of the contest.\n");
    return 0;
}

MC_AddVariableToSolution_int

Prototype / Description

int MC_AddVariableToSolution_int(const char *pVariableName, int Variable)

Once you solved the challenge, you need to add the answer(s) to the final solution. Then, you will call MC_SendSolution that will send all your answers to the website. You should use this function to add int variables to the solution.

Parameters

  • [in] const char *pVariableName : The identificator string of the variable you want to add to the solution, written on every contest page.
  • [int] int Variable : The int variable you want to add to the solution.

Return value

  • [out] int : 1 if the function succeeded, 0 otherwise.

Example

int Number = 0;
			
// computing the value of Number...

ErrorCode = MC_AddVariableToSolution_int("frequency", Number);
if(ErrorCode == 0)
{
	printf("Impossible to add the variable(s) to the solution\n");
	return 0;
}

MC_AddVariableToSolution_float

Prototype / Description

int MC_AddVariableToSolution_float(const char *pVariableName, float Variable)

Once you solved the challenge, you need to add the answer(s) to the final solution. Then, you will can MC_SendSolution that will send all your answers to the website. You should use this function to add float variables to the solution.

Parameters

  • [in] const char *pVariableName : The identificator string of the variable you want to add to the solution, written on every contest page.
  • [int] float Variable : The float variable you want to add to the solution.

Return value

  • [out] int : 1 if the function succeeded, 0 otherwise.

Example

int Freq = 0;
float Duration = 0;
			
// computing the value of Freq and Duration...

ErrorCode = MC_AddVariableToSolution_int("frequency", Freq);
ErrorCode *= MC_AddVariableToSolution_float("duration", Duration);
if(ErrorCode == 0)
{
	printf("Impossible to add the variable(s) to the solution\n");
	return 0;
}

MC_AddVariableToSolution_char

Prototype / Description

int MC_AddVariableToSolution_char(const char *pVariableName, const char *pVariable, int Length)

Once you solved the challenge, you need to add the answer(s) to the final solution. Then, you will can MC_SendSolution that will send all your answers to the website. You should use this function to add strings to the solution.

Parameters

  • [in] const char *pVariableName : The identificator string of the variable you want to add to the solution, written on every contest page.
  • [int] const char *pVariable : The string you want to add to the solution.
  • [int] int Length : The length of the string you want to add to the solution. Be carefull, use the function strlen only if you are sure there are no null characters inside.

Return value

  • [out] int : 1 if the function succeeded, 0 otherwise.

Example

char PlainText[] = "HELLO THIS IS THE SOLUTION STRING";

ErrorCode = MC_AddVariableToSolution_char("plain_text", PlainText, strlen(PlainText);
if(ErrorCode == 0)
{
	printf("Impossible to add the variable(s) to the solution\n");
	return 0;
}

MC_SendSolution

Prototype / Description

int MC_SendSolution(MC_ResultStruct *pResult)

Once you solved the challenge and added all the answer variables to the solution, you need to call this function in order to send the solution to the website. *pResult is filled with the results.

Parameters

  • [out] MC_ResultStruct *pResult : A pointer on a MC_ResultStruct variable that will receive the results of the challenge (succeeded or not, points earned etc). Use the function MC_ResultMessage in order to visualise the results. See here for more details about this structure.

Return value

  • [out] int : An error code (see here).

Example

MC_ResultStruct Res;
			
MC_AddVariableToSolution_char("txt_clair", pPlainText, strlen(pPlainText));
	
ErrorCode = MC_SendSolution(&Res);
if(ErrorCode != MC_OK)
    MC_ErrorMessage(ErrorCode, 1);
 
MC_ResultMessage(&Res, 1);

MC_ResultMessage

Prototype / Description

char* MC_ResultMessage(MC_ResultStruct *pResult, int Print)

Once you sent the solution, a MC_ResultStruct structure has been filled. Use this function to get a formatted summary of the results. You can choose to print it or the get a pointer on the formatted string.

Parameters

  • [in] MC_ResultStruct *pResult : A pointer on a MC_ResultStruct variable that has been filled with the results by MC_SendSolution. See here for more details about this structure.
  • [in] int Print : 1 if you want to print the summary in the standard output, or 0 otherwise.

Return value

  • [out] char* : A pointer on the formatted result string.

Example

MC_ResultStruct Res;
			
MC_AddVariableToSolution_char("txt_clair", pPlainText, strlen(pPlainText));
	
ErrorCode = MC_SendSolution(&Res);
if(ErrorCode != MC_OK)
    MC_ErrorMessage(ErrorCode, 1);
 
MC_ResultMessage(&Res, 1);

MC_ErrorMessage

Prototype / Description

char* MC_ErrorMessage(unsigned int ErrorCode, int Print)

Most of the functions of the library return an error code. You can consult the meaning here, or use this function.

Parameters

  • [in] unsigned int ErrorCode : The error code you want to get the message.
  • [in] int Print : 1 if you want to print the error message in the standard output, or 0 otherwise.

Return value

  • [out] char* : A pointer on the formatted error message string.

Example

MC_ResultStruct Res;
			
MC_AddVariableToSolution_char("txt_clair", pPlainText, strlen(pPlainText));
	
ErrorCode = MC_SendSolution(&Res);
if(ErrorCode != MC_OK)
    MC_ErrorMessage(ErrorCode, 1);
 
MC_ResultMessage(&Res, 1);