Feedback | If you notice incorrect translations in Contester, please let author know.
|
|
How do i write a solution in C++? answer answer |
Your solution should read the input data from the standard input (console) or from input.txt file, and write the output data to the standard output (console). Below are the example solutions of A+B problem:
#include <iostream>
using namespace std;
int main() { int a, b; cin >> a; cin >> b; cout << a + b << "\n"; char wait; cin >> wait; return 0; }
| #include <iostream>
using namespace std;
int main() { freopen("input.txt", "rt", stdin); int a, b; cin >> a >> b; cout << a + b; return 0; }
|
Exceptions, thrown by solutions during runtime inside a try..catch block, are ignored by the system. Exceptions, thrown by solutions outside a try..catch block, cause a Runtime Error. Solutions are compiled on the server with an ONLINE_JUDGE directive turned on.
|
How do i write a solution in Pascal? answer answer |
In Delphi environment you should create new solution using menu File - New... - Console Application. Your solution code should containt {$APPTYPE CONSOLE} directive and string uses SysUtils; . Your solution should read the input data from the standard input (console) or from input.txt file, and write the output data to the standard output (console). Below are the example solutions of A+B problem:
{$APPTYPE CONSOLE}
uses SysUtils;
var a, b: Integer; begin ReadLn(a); ReadLn(b); WriteLn(a + b); ReadLn; end.
| {$APPTYPE CONSOLE}
uses SysUtils;
var a, b: Integer; begin AssignFile(input, 'input.txt'); Reset(input); ReadLn(a, b); WriteLn(a + b); end.
|
Exceptions, thrown by solutions during runtime inside a try..except block, are ignored by the system. Exceptions, thrown by solutions outside a try..except block, cause a Runtime Error. Solutions are compiled on the server with an ONLINE_JUDGE directive turned on.
|
How do i write a solution in Java? answer answer |
Your solution should read the input data from the standard input (console) or from input.txt file, and write the output data to the standard output (console). Below are the example solutions of A+B problem:
import java.io.*; import java.util.*;
class solver { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); StringTokenizer str; str = new StringTokenizer(in.readLine()); int a = Integer.parseInt(str.nextToken()); str = new StringTokenizer(in.readLine()); int b = Integer.parseInt(str.nextToken()); out.println(a + b); out.flush(); } }
| import java.io.*; import java.util.*;
class solver { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new FileReader("input.txt")); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); StringTokenizer str; str = new StringTokenizer(in.readLine()); int a = Integer.parseInt(str.nextToken()); str = new StringTokenizer(in.readLine()); int b = Integer.parseInt(str.nextToken()); out.println(a + b); out.flush(); } }
|
Solutions are compiled on the server with an ONLINE_JUDGE directive turned on.
|
How do i write a solution in C# .NET? answer answer |
Your solution should read the input data from the standard input (console) or from input.txt file, and write the output data to the standard output (console). Below are the example solutions of A+B problem:
using System;
class solver { public static void Main(string[] args) { string[] tokens; tokens = Console.ReadLine().Split(' '); int a = Convert.ToInt32(tokens[0]); tokens = Console.ReadLine().Split(' '); int b = Convert.ToInt32(tokens[0]); Console.WriteLine(a + b); } }
|
Solutions are compiled on the server with an ONLINE_JUDGE directive turned on.
|
How do i write a solution in J# .NET? answer answer |
Your solution should read the input data from the standard input (console) or from input.txt file, and write the output data to the standard output (console). Below are the example solutions of A+B problem:
import System.*;
class solver { public static void main() { String[] tokens; tokens = Console.ReadLine().Split(new char[] {' '}); int a = Convert.ToInt32(tokens[0]); tokens = Console.ReadLine().Split(new char[] {' '}); int b = Convert.ToInt32(tokens[0]); Console.WriteLine(a + b); } }
|
Solutions are compiled on the server with an ONLINE_JUDGE directive turned on.
|
How do i write a solution in Visual Basic .NET? answer answer |
Your solution should read the input data from the standard input (console) or from input.txt file, and write the output data to the standard output (console). Below are the example solutions of A+B problem:
Imports System
Module solver
Sub Main() Dim tokens As String() tokens = Console.ReadLine().Split(New [Char]() {" "c}) Dim a As Integer = Convert.ToInt32(tokens(0)) tokens = Console.ReadLine().Split(New [Char]() {" "c}) Dim b As Integer = Convert.ToInt32(tokens(0)) Console.WriteLine(a + b) End Sub
End Module
|
Solutions are compiled on the server with an ONLINE_JUDGE directive turned on.
|
What results of checking mean? answer answer |
Accepted! | • Solution was successfully compiled and passed all tests.
| Compilation Error | • Server compiler "considered" that solution had a syntax error. • Solution file was not saved in development environment or a wrong file was submitted. • Incorrect compiler / programming language was chosen. If compilation error occure, the compilation log becomes available to the user.
| Wrong Answer | • Solution gave an incorrect answer for the test. • Solution file was not saved in development environment or a wrong file was submitted. • Solution contains uninitialized variables. • Iteration variable is used after "for".
| Presentation Error | • Solution gave an answer in wrong format, wrote less data than needed, or extra data. • Solution file was not saved in development environment or a wrong file was submitted. • Solution contains uninitialized variables. • Iteration variable is used after "for". • Solution wrote data into output.txt , but must write to console. • If solution is in Delphi, probably, string uses SysUtils; is absent.
| Runtime Error | • A runtime error (exception) occured. • Solution works with files (can work only with input.txt ).
| Time Limit | • Solution consumed more time, than allowed by the statement. • Solution "hang".
| Memory Limit | • Solution consumed more memory, than allowed by the statement.
| Security Violation | • Solution contains calls to restricted functions.
| Waiting | • Solutions waits for being checked. Server is busy checking other solutions.
| Waiting (C) | • Contester can not find suitable compiler for your solution.
| Checking | • Solution is being checked by the server now.
|
|
Как загружать новые задачи? Что значит zip-файл? answer answer |
Новые задачи распостраняются в виде zip-файлов, содержащих условие и данные, необходимые для проверки отправляемых решений. Одна задача в одном файле. Для внесения задачи распаковывать zip-файл не нужно. Чтобы внести в Contester новую задачу, войдите с правами администратора (имя Admin, пароль по умолчанию admin), создайте в нужном разделе пустую задачу с произвольным именем (оно будет позже заменено) и "загрузите zip-файл". Проверяющие программы (чекеры) к большинству задач написаны на паскале, поэтому, вероятно, вам придется сначала установить компилятор паскаля (например, Delphi 7). Скачать zip-файлы с новыми задачами вы можете с официального сайта www.contester.ru.
|
|