ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Общий форум

Why do I get Compilation Error?
Послано Igor3T 7 окт 2006 00:52
I won't say you what problem is it.
I get compilation error for this code:
// forograf.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>

using namespace std;

#define ex4(wer,ser) {int t=mas[f]; mas[f]=mas[i]; mas[i]=t;}

int mas[60];
    int n,vars=0;
bool sum_next;

bool can_swap(int a, int b)
{
    if (a!=b)
    {
        if ((a>1)&&(b<n-1))
        {
        if ((abs(mas[a-1]-mas[b])<3) &&
            (abs(mas[a+1]-mas[b])<3) &&
            (abs(mas[a]-mas[b-1])<3) &&
            (abs(mas[a]-mas[b+1])<3))
                return(true); else return(false);
        } else
    if     ((abs(mas[a-1]-mas[b])<3) &&
            (abs(mas[a+1]-mas[b])<3) &&
            (abs(mas[a]-mas[b-1])<3))
                return(true); else return(false);
    } else return(false);
}

int get_var(int f)
{
    int c=0;
    if (f==n) return(0);
    for ( ; (f<n)&&(sum_next); f++)
    for (int i=f+1; i<n; i++)
        if (can_swap(f,i))
        {
            ex4(f,i);
            if (sum_next) vars++;
            get_var(f+1);
            ex4(f,i);
        }
    sum_next=false;}

int _tmain()
{
    cin >> n;
    for (int i=0; i<n+2; i++) mas[i]=i+1;

    for (int i=n; i>1; i--) {
        sum_next=true; get_var(i-1); }

    cout << vars+1;

    return 0;
}

Why? I use Microsoft Visual Studio 2005 (C++)



Edited by author 07.10.2006 00:55

Edited by author 07.10.2006 00:55
Re: Why do I get Compilation Error?
Послано Soul Reaver 30 окт 2006 21:45
Becouse not _tmain it mast be only main() :)