Submission #89343

#TimeUsernameProblemLanguageResultExecution timeMemory
89343jasony123123Poklon (COCI17_poklon7)C++11
Compilation error
0 ms0 KiB
import java.util.*; import java.io.*; import java.math.*; class poklon { static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer token; static int N; static int[][] C; static BigInteger two = new BigInteger("2"); public static void main(String[] args) throws IOException { nextLn(); N = nextInt(); C = new int[N+1][2]; for(int i = 1; i<=N; i++) { nextLn(); C[i][0] = nextInt(); C[i][1] = nextInt(); } BigInteger ans = dfs(1); System.out.println(ans.toString(2)); // System.out.println(ans); } public static BigInteger dfs(int x) { if(x<0) { return new BigInteger(Integer.toString(-x)); } BigInteger l = dfs(C[x][0]), r = dfs(C[x][1]); BigInteger ans; if(l.compareTo(r)>0) ans = l; else ans = r; return ans.multiply(two); } //nextLn moves the token to the nextLine public static void nextLn() throws IOException { token = new StringTokenizer(reader.readLine()); } //nextInt returns the next available integer public static int nextInt() { return Integer.parseInt(token.nextToken()); } //nextDouble returns the next available integer public static double nextDouble() { return Double.parseDouble(token.nextToken()); } //next returns the next word separated by spaces public static String next() { return token.nextToken(); } }

Compilation message (stderr)

poklon.cpp:1:1: error: 'import' does not name a type; did you mean 'short'?
 import java.util.*;
 ^~~~~~
 short
poklon.cpp:2:1: error: 'import' does not name a type; did you mean 'short'?
 import java.io.*;
 ^~~~~~
 short
poklon.cpp:3:1: error: 'import' does not name a type; did you mean 'short'?
 import java.math.*;
 ^~~~~~
 short
poklon.cpp:6:9: error: 'BufferedReader' does not name a type
  static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
         ^~~~~~~~~~~~~~
poklon.cpp:7:9: error: 'StringTokenizer' does not name a type
  static StringTokenizer token;
         ^~~~~~~~~~~~~~~
poklon.cpp:10:12: error: expected unqualified-id before '[' token
  static int[][] C;
            ^
poklon.cpp:11:9: error: 'BigInteger' does not name a type
  static BigInteger two = new BigInteger("2");
         ^~~~~~~~~~
poklon.cpp:13:9: error: expected ':' before 'static'
  public static void main(String[] args) throws IOException {
         ^~~~~~
poklon.cpp:13:26: error: 'String' has not been declared
  public static void main(String[] args) throws IOException {
                          ^~~~~~
poklon.cpp:13:35: error: expected ',' or '...' before 'args'
  public static void main(String[] args) throws IOException {
                                   ^~~~
poklon.cpp:13:39: error: expected ';' at end of member declaration
  public static void main(String[] args) throws IOException {
                                       ^
poklon.cpp:13:41: error: 'throws' does not name a type
  public static void main(String[] args) throws IOException {
                                         ^~~~~~
poklon.cpp:27:9: error: expected ':' before 'static'
  public static BigInteger dfs(int x) {
         ^~~~~~
poklon.cpp:27:16: error: 'BigInteger' does not name a type
  public static BigInteger dfs(int x) {
                ^~~~~~~~~~
poklon.cpp:41:9: error: expected ':' before 'static'
  public static void nextLn() throws IOException {
         ^~~~~~
poklon.cpp:41:28: error: expected ';' at end of member declaration
  public static void nextLn() throws IOException {
                            ^
poklon.cpp:41:30: error: 'throws' does not name a type
  public static void nextLn() throws IOException {
                              ^~~~~~
poklon.cpp:45:9: error: expected ':' before 'static'
  public static int nextInt() {
         ^~~~~~
poklon.cpp:49:9: error: expected ':' before 'static'
  public static double nextDouble() {
         ^~~~~~
poklon.cpp:53:9: error: expected ':' before 'static'
  public static String next() {
         ^~~~~~
poklon.cpp:53:16: error: 'String' does not name a type
  public static String next() {
                ^~~~~~
poklon.cpp:56:2: error: expected ';' after class definition
 }
  ^
  ;
poklon.cpp: In static member function 'static int poklon::nextInt()':
poklon.cpp:46:10: error: 'Integer' was not declared in this scope
   return Integer.parseInt(token.nextToken());
          ^~~~~~~
poklon.cpp:46:27: error: 'token' was not declared in this scope
   return Integer.parseInt(token.nextToken());
                           ^~~~~
poklon.cpp:46:27: note: suggested alternative: 'poklon'
   return Integer.parseInt(token.nextToken());
                           ^~~~~
                           poklon
poklon.cpp: In static member function 'static double poklon::nextDouble()':
poklon.cpp:50:10: error: 'Double' was not declared in this scope
   return Double.parseDouble(token.nextToken());
          ^~~~~~
poklon.cpp:50:10: note: suggested alternative: 'double'
   return Double.parseDouble(token.nextToken());
          ^~~~~~
          double
poklon.cpp:50:29: error: 'token' was not declared in this scope
   return Double.parseDouble(token.nextToken());
                             ^~~~~
poklon.cpp:50:29: note: suggested alternative: 'poklon'
   return Double.parseDouble(token.nextToken());
                             ^~~~~
                             poklon