РГАТУ ACM ONLINE (RSATU)
Current time
13:04:24

INTRO   AUTHORIZATION   REGISTRATION   TASKS   MONITOR   FORUM

Примеры оформления решений с пробного турнира 2009 года



====================================================================
Java
====================================================================


import java.io.*;
import java.util.StringTokenizer;

public class seq {
    public static void main(String[] args) throws IOException {

        BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));
        StringTokenizer st = new StringTokenizer(r.readLine());

        int n = Integer.parseInt(st.nextToken());

        int[] f = new int[13];

        f[1] = f[3] = f[5] = f[7] = f[8] = f[10] = f[12] = 31;
        f[2] = 28;
        f[4] = f[6] = f[9] = f[11] = 30;

        PrintWriter pw = new PrintWriter(new FileOutputStream("output.txt"));

        pw.print(f[n]);

        pw.close();
    }

}




====================================================================
ObjectPascal
====================================================================


var
  N: Integer;
begin
  Reset(Input, 'input.txt');
  Readln(N);
  Close(Input);
  Rewrite(Output, 'output.txt');
  case N of
    1, 3, 5, 7, 8, 10, 12: Writeln(31);
    2: Writeln(28);
  else Writeln(30);
  end;
  Close(Output);
end.



====================================================================
BorlandC
====================================================================


#include <cstdio>
#include <windows.h>

using namespace std;

int n;
int f[13];

void Read()
{

        FILE     *in;

        in = fopen("input.txt", "r+");


	fscanf(in, "%d", &n);

        fclose(in);
}

double OX, OY;

void Work()
{
        f[1] = f[3] = f[5] = f[7] = f[8] = f[10] = f[12] = 31;
        f[2] = 28;
        f[4] = f[6] = f[9] = f[11] = 30;
}

void Write()
{
        FILE	*out;

        out = fopen("output.txt", "w+");


	fprintf(out, "%d\n", f[n]);

        fclose(out);
}

WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	Read();
	Work();
	Write();
	return 0;
}




====================================================================
VisualC
====================================================================


#include <cstdio>
#include <windows.h>

using namespace std;

int n;
int f[13];

void Read()
{

        FILE     *in;

        in = fopen("input.txt", "r+");


	fscanf(in, "%d", &n);

        fclose(in);
}

double OX, OY;

void Work()
{
        f[1] = f[3] = f[5] = f[7] = f[8] = f[10] = f[12] = 31;
        f[2] = 28;
        f[4] = f[6] = f[9] = f[11] = 30;
}

void Write()
{
        FILE	*out;

        out = fopen("output.txt", "w+");


	fprintf(out, "%d\n", f[n]);

        fclose(out);
}

int WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine,int nCmdShow)
{
	Read();
	Work();
	Write();
	return 0;
}




====================================================================
gcc
====================================================================


#include <cstdio>

int n;
int f[13];

void Read()
{

        FILE     *in;

        in = fopen("input.txt", "r+");


	fscanf(in, "%d", &n);

        fclose(in);
}

double OX, OY;

void Work()
{
        f[1] = f[3] = f[5] = f[7] = f[8] = f[10] = f[12] = 31;
        f[2] = 28;
        f[4] = f[6] = f[9] = f[11] = 30;
}

void Write()
{
        FILE	*out;

        out = fopen("output.txt", "w+");


	fprintf(out, "%d\n", f[n]);

        fclose(out);
}

int main()
{
	Read();
	Work();
	Write();
	return 0;
}


www.rsatu.ru     (admin)