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

Обсуждение задачи 1313. К вопросу о спорте

logicerror Compilation Error??? [1] // Задача 1313. К вопросу о спорте 27 фев 2005 20:38
Why? here's my code:

#include <iostream>
#include <stdlib.h>
#include <fstream>

using namespace std;

int main(int argc, char *argv[])
{
  int n;
  ifstream file;
  file.open("input.txt", ios::in);
  file >> n;
  int arr[n+1][n+1];
  int result[n*n];
  for (int j=1; j<=n; j++)
    for (int i=1; i<=n; i++)
      file >> arr[i][j];

  file.close();
  int start_x=1,end_x=1,x=0,y=2;
  int start_y=1,end_y=1;
  ofstream ofile;
  ofile.open("output.txt", ios::out);
  for (int i=1; i<=n*n; i++)
  {
    x++;
    if (x > end_x) { x=start_x; end_x++; }
    if (end_x > n) { end_x=n; start_x++; x=start_x; }
    y--;
    if (y < end_y) { y=++start_y; }
    if (start_y > n) { y=start_y=n; end_y++; }

    ofile << arr[x][y] << " ";
  }
  ofile.close();
  system("PAUSE");
  return 0;
}


please tell me what's the problem...
Heaven Why you deal with files? (+) // Задача 1313. К вопросу о спорте 27 фев 2005 20:52
Use standart i/o stream. Do not use system function