Top 20

1 0x00h 695 pts
2 boris39 695 pts
3 neoxquick 676 pts
4 maf-ia 658 pts
5 eax 657 pts
6 thefinder 639 pts
7 benito255 604 pts
8 nikokks 597 pts
9 mego 588 pts
10 madbat2 579 pts
11 plucth 561 pts
12 Mart 549 pts
13 Stupefy 529 pts
14 tehron 502 pts
15 Kithyane 497 pts
16 rostale 480 pts
17 egosum 470 pts
18 malose 427 pts
19 CoYoTe99 414 pts
20 Undr 412 pts

Classement complet

Shoutbox

6 Nov - 8:17 am

Bonjour, un léger problème sur l'épreuve 10 : Une fois réussie, le champ "points earned" indique 72 au lieu de 7 En revanche sur le site le nombre de points comptabilisés est bien 7 Merci pour ce site génial !

21 Oct - 9:48 pm

Équation du challenge 52 corrigée, merci

16 Oct - 8:43 am

Bonjour, il y a aussi un problème d'affichage "invalid equation" dans le challenge 52. Merci

14 Oct - 8:57 pm

Barbapapou l'équation du challenge 29 a été corrigée

4 Oct - 10:30 am

Bonjour, il y a un problème avec l'affichage d'une équation dans le challenge 29

24 Aug - 7:10 pm

@rostale, en effet l'épreuve 21 ne fonctionne plus depuis un moment, pour l'instant on a pas prévu de temps pour la réparer je pense qu'on va finir par la supprimer tout simplement. @nikokks, ok je t'envoie un mail

22 Aug - 11:40 pm

Salut Metatr0n. pourrait on avoir une discussion en MP. J'imagine que tu as mon mail. Ce serait pour discuter de microcontest en general.

28 Jul - 10:38 pm

Pouvez-vous vérifier l'épreuve Email (21) ? En effet, je ne reçois pas d'email de la part du site. Merci

28 Jul - 7:29 pm

Bonjour et merci. Cependant, j'ai résolu le challenge qui me posait pb, donc plus rien à demander... pour l'instant.

28 Jul - 1:48 pm

Ça devrait être réparé maintenant

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

Example of a challenge resolution II

Example presention

In this example, we are going to solve a simple challenge about strings. This is Ave Caesar I.
As you can see on the page of the challenge, the ID is 4, we are going to use this piece of information in the code in order to solve it.
This example is aimed at showing how to handle strings with the libraries.
Let's see what the solutions look like in C/C++, Java and Python.

Solution in C/C++

This ID (4) is used at this line :

ErrorCode = MC_StartContest(4, "Your nickname", "Your password");
Solution :
#include "microcontest2.h"
#include <stdio.h>
 
int main()
{
/************************************************************************/
/*********************VARIABLES DECLARATIONS*****************************/
/************************************************************************/
 
    MC_ResultStruct Res;                                    // Structure that will be filled with the results information
    unsigned int ErrorCode;
    int LibUpToDate;
 
    char *pCryptedText = NULL;                              // Variables related to the
	unsigned int CryptedTextLength = 0;                     // contest.
	char *pPlainText = NULL;
    int Key = 0;
    unsigned int c = 0;

/************************************************************************/
/*************CHECKING IF THE LIB MICROCONTEST IS UP TO DATE*************/
/************************************************************************/
 
    ErrorCode = MC_CheckLibVersion(&LibUpToDate);           // Check if the lib microcontest is up to date
    if(ErrorCode != MC_OK)
    {
        MC_ErrorMessage(ErrorCode, 1);                      // This function prints the message of the error.
        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");
    }
 
/************************************************************************/
/*****CONNECTING TO THE CHALLENGE AND GETTING THE VARIABLES VALUES*******/
/************************************************************************/
 
    ErrorCode = MC_StartContest(4, "Your nickname", "Your password");           // Call this function to make the library get the variables values of a challenge.
    if(ErrorCode != MC_OK)
    {
        MC_ErrorMessage(ErrorCode, 1);
        return 0;
    }
 
	ErrorCode = MC_GetParam_char("txt_crypte", &pCryptedText, &CryptedTextLength);    // Get the variables values. Depending on the contest, you can get int,
    ErrorCode *= MC_GetParam_int("key", &Key);                                        // float, or string values thanks to the functions MC_GetParam_xxx.
    if(ErrorCode == 0)
    {
        printf("Impossible to get the contest data. Please check the ID of the contest.\n");
        return 0;
    }
 
/************************************************************************/
/*********************SOLVING THE CHALLENGE******************************/
/************************************************************************/
 
	pPlainText = (char *)malloc((CryptedTextLength + 1)*sizeof(char));              // Solve the contest itself here
	if(pPlainText == NULL)
	{
		printf("Error, impossible to allocate the memory for pPlainText\n");
		return 0;
	}
	else
		pPlainText[CryptedTextLength] = 0;

    for(c = 0; c < CryptedTextLength; c++)
	{
		pPlainText[c] = pCryptedText[c] - Key;
		if(pPlainText[c] < 65)
			pPlainText[c] += 26;
	}

	printf("Crypted text :\t%s\n", pCryptedText);
	printf("Key :\t\t%d\n", Key);
	printf("Plain text:\t%s\n\n", pPlainText);
 
/************************************************************************/
/*SENDING THE SOLUTION TO THE SERVER AND PRINTING THE RESULT INFORMATION*/
/************************************************************************/
 
	MC_AddVariableToSolution_char("txt_clair", pPlainText, strlen(pPlainText));      // Add the variable to the solution. You can add several depending on 
                                                                                     // the contest
    free(pPlainText);
	
	ErrorCode = MC_SendSolution(&Res);                                               // Send the solution to the server
    if(ErrorCode != MC_OK)
        MC_ErrorMessage(ErrorCode, 1);
 
    MC_ResultMessage(&Res, 1);                              // This function prints a summary of the results
 
    return 0;
}
download source file (copy/paste adds special characters)

Solution in Python

This ID (4) is used at this line :

cont = commence_contest(4, "Your nickname", "Your password")
Solution :
# -*- coding: utf-8 -*-
from libmicrocontest2_python27 import *

if not check_version():
    print "Warning: the version of the libmicrocontest2 is not the last one."
    print "Current version :\t" + get_currentversion()
    print "This program may not work properly. Consider downloading the latest version on\nthis page : http://www.microcontest.com/download.php\n"   

cont = commence_contest(4, "Your nickname", "Your password")
# short form uses username, password from credentials.py
# cont = commence_contest(1)

CryptedText = cont.get_str('txt_crypte')
Key = cont.get_int('key')
PlainText = ''

for c in CryptedText:
    NewChar = ord(c) - Key
    if NewChar < 65:
        NewChar += 26
    PlainText += chr(NewChar)

print 'CryptedText:\t' + CryptedText
print 'Key:\t\t' + str(Key)
print 'PlainText:\t' + PlainText

cont.append_answer("txt_clair", PlainText)
print(cont.submit_answer())
download source file (copy/paste adds special characters)

Solution in Java

This ID (4) is used at this line :

Contest cont = Contest.commenceContest(4, "Your nickname", "Your password");
Solution :
import com.microcontest.Libmicrocontest2;
import com.microcontest.Contest;

public class Contest4 {
	public static void main(String[] args) {
		
		if(Libmicrocontest2.checkVersion() == false)
		{
			System.out.println("Warning: the version of the libmicrocontest2 is not the last one.");
			System.out.println("Current version :\t" + Libmicrocontest2.VERSION);
			System.out.println("This program may not work properly. Consider downloading the latest version on this page : http://www.microcontest.com/download.php\n");
		}
		
		Contest cont = Contest.commenceContest(4, "Your nickname", "Your password");
		// Contest cont = Contest.commenceContest(4); if you use credentials
		
		int key = cont.getInt("key");
		String txt_crypted = cont.getParam("txt_crypte");
		char[] txt_plain = new char[txt_crypted.length()];
		
		for(int c = 0; c < txt_crypted.length(); c++)
	    {
			txt_plain[c] = (char)(txt_crypted.charAt(c) - key);
	        if(txt_plain[c] < 65)
	        	txt_plain[c] += 26;
	    }
		
		System.out.println("Crypted text :\t" + txt_crypted);
		System.out.println("Key :\t\t" + key);
		System.out.println("Plain text :\t" + String.valueOf(txt_plain));
		
		cont.appendAnswer("txt_clair", String.valueOf(txt_plain));
		System.out.println(cont.submitAnswer());
	}
}
download source file (copy/paste adds special characters)

Solution in PHP

This ID (4) is used at this line :

$contest->startContest(4, 'Your nickname', 'Your password');
Solution :
<?php

// We include the µContest library
require 'libmicrocontest2.php';

$contest = new uContest();

// We check if the µContest library is up to date
if($contest->checkVersion() == 0)
{
	echo 'Warning: the version of the libmicrocontest2 is not the last one.<br />';
	echo 'Current version : ' . $contest->version . '<br />';
	echo 'This program may not work properly. Consider downloading the latest version on this page : http://www.microcontest.com/download.php<br /><br />';
}

// We connect to the challenge
try {
	$contest->startContest(4, 'Your nickname', 'Your password');
} catch (Exception $ex) { echo $ex->getMessage(); exit(); }

// We get the variables of the challenge
$key = intval($contest->getParam('key'));
$cryptedText = $contest->getParam('txt_crypte');

// We solve the challenge itself
$plainText = '';
foreach(str_split($cryptedText) as $c)
{
    $newChar = ord($c) - $key;
    if($newChar < 65)
        $newChar += 26;

    $plainText .= chr($newChar);
}

echo "key = $key<br />";
echo "cryptedText = $cryptedText<br />";
echo "plainText = $plainText<br /><br />";

// We add the answer to the answer to be sent. You can add several answers, depending on the challenge
$contest->appendAnswer('txt_clair', $plainText);

// We send the answer(s) and print the result
try {
	$result = $contest->sendAnswer();
} catch (Exception $ex) { echo $ex->getMessage(); exit(); }

print_r($result);

?>
download source file (copy/paste adds special characters)
Remove the '_' at the end of the file name

Solution in any other language

Of course, it is possible to solve the challenges in any other language. But for that, you must develop your own functions of communication with the webiste.
You can take a look at the source code of our libraries to help yourself.
The mecanisms of communication are described on the page Interface.