Блог пользователя twitu

Автор twitu, история, 6 лет назад, По-английски

I have a library of data structures I commonly use, however I find it difficult to use them on codeforces because it requires one pubic class only. There are other editors however that support multiple classes.

This my programme structure:
~~~~~
class Digraph {}
class Bag {} // Bag is used by Digraph
public class {
static digraph
// declare other static variables
static recursivefunction () // operates on digraph
static solution () // computes and prints solution and calls recursive function, instantiate digraph
static void main() // calls solution
}
~~~~~
The problem came up because codeforces judge would accept only one public class

So i tried this:
~~~~~
public class { class Digraph {}
class Bag {} // Bag is used by Digraph
static digraph
// declare other static variables
static recursivefunction () // operates on digraph
static solution () // computes and prints solution and calls recursive function, instantiate digraph
static void main() // calls solution
}
~~~~~
This gives an error that when declaring digraph because Main.this.Digraph cannot be accessed from a static context.

So, how do i use classes in a conflict free manner. Your answer would be of great help.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится