Top 20

1 0x00h 705 pts
2 boris39 705 pts
3 neoxquick 686 pts
4 maf-ia 667 pts
5 thefinder 648 pts
6 benito255 612 pts
7 mego 594 pts
8 madbat2 585 pts
9 Mart 557 pts
10 tehron 507 pts
11 Kithyane 506 pts
12 plucth 483 pts
13 egosum 477 pts
14 CoYoTe99 420 pts
15 Undr 418 pts
16 Zeta 418 pts
17 loonies2 414 pts
18 Armavica 413 pts
19 vitalimarrenra 406 pts
20 b0n0n 398 pts

Classement complet

Shoutbox

20 Sep - 10:46 am

Bonjour à tous, j'ai créé un nouveau topic sur le forum concernant un problème que je rencontre sur plusieurs challenges, comme il n'est plus très actif, que j'aimerais pouvoir avancer sur ces challenges et que ce chat a une meilleure visibilité, je poste ce message ici en espérant qu'une âme charitable puisse m'aider en répondant à mon message sur le forum :)

3 Sep - 9:39 am

Ah ok je n'avais pas bien compris ton message original. Très bien, ce que tu peux faire c'est poster un message sur le forum avec le lien de téléchargement et les explications. Merci pour ta contribution !

1 Sep - 5:52 pm

Bonjour bonjour, je l'ai créé en Pharo, une implémentation récente du langage smalltalk.

31 Aug - 2:43 pm

Bonjour PharoGuy, re-bienvenue à toi ! Tu as créé cet objet en quel langage ?

30 Aug - 8:23 pm

Bonjour tout le monde ! je redécouvre ce site avec Pharo ! J'ai créé un objet qui gère la récupération et l'envoi des variables, ça pourrait intéresser ?

24 Jul - 5:30 pm

Ça devrait être à nouveau opérationnel, définitivement cette fois ci.

19 Jul - 8:42 pm

A nouveau ? On regarde ça !

16 Jul - 5:26 pm

Bonjour à tous :) Je viens d'essayer de valider le challenge "Wav ? (6)", et j'ai l'impression que la page "validation.php" est de nouveau en carafe.

15 Jul - 8:43 pm

Cool !! Merci beaucoup !!

9 Jul - 11:20 pm

Hello, je regarde ça dès que je peux, probablement demain

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 I

Example presention

In this example we are going to use the simplest challenge, which is the Sum of two numbers.
As you can see on the page of the challenge, the ID is 1, we are going to use this piece of information in the code in order to solve it.
We can also learn the parameters we will have to get, "a" and "b", and we see that the solution (a + b) has to be sent in the variable "s".
Let's see what the solutions look like in C/C++, Java and Python.

Solution in C/C++

This ID (1) is used at this line :

ErrorCode = MC_StartContest(1, "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;

	int a, b;												// Variables related to the
	int s;													// contest.
	
/************************************************************************/
/*************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(1, "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_int("a", &a);					// Get the variables values. Depending on the contest, you can get int,
	ErrorCode *= MC_GetParam_int("b", &b);					// 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******************************/
/************************************************************************/

	s = a + b;												// Solve the contest itself here

/************************************************************************/
/*SENDING THE SOLUTION TO THE SERVER AND PRINTING THE RESULT INFORMATION*/
/************************************************************************/

	MC_AddVariableToSolution_int("s", s);					// Add the variable to the solution. You can add several depending on 
															// the contest
	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 (1) is used at this line :

cont = commence_contest(1, "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(1, "Your nickname", "Your password")
# short form uses username, password from credentials.py
# cont = commence_contest(1)

a = int(cont.get_param("a", int))
# you can also use get_int, get_float, get_str
b = cont.get_int("b")
# or use it that way (it tries to return the right type automagically)
# s = cont.a + cont.b

s = a + b

# then append the answer
cont.append_answer("s", s)
# then submit the answer and print result
print(cont.submit_answer())
#or pass tuples directly to submit_answer (here using the short version)
#print cont.submit_answer([("s", cont.a + cont.b)])
download source file (copy/paste adds special characters)

Solution in Java

This ID (1) is used at this line :

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

public class Contest1 {
	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(1, "Your nickname", "Your password");
		// Contest cont = Contest.commenceContest(1); if you use credentials
		
		int a = cont.getInt("a");
		int b = cont.getInt("b");
		// you can also use getDouble (for floating point values) and getParam (for strings)
		
		// append the answer
		cont.appendAnswer("s", a + b);
		
		// then submit the answer and print result
		System.out.println(cont.submitAnswer());
	}
}
download source file (copy/paste adds special characters)

Solution in PHP

This ID (1) is used at this line :

$contest->startContest(1, '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(1, 'Your nickname', 'Your password');
} catch (Exception $ex) { echo $ex->getMessage(); exit(); }

// We get the variables of the challenge
$a = $contest->getParam('a');
$b = $contest->getParam('b');

// We solve the challenge itself
$s = $a + $b;

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

// 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.