Submission #1603084


Source Code Expand

<?php

class In {

	private $buf = [];
	private $count = 0;
	private $pointer = 0;

	public function nextLine() {
		$ret = '';
		if($this->hasNext()){
			while($this->hasNext()){
				$ret .= $this->next();
			}
		}else{
			$ret = trim(fgets(STDIN));
		}

		return $ret;
	}

	public function next() {
		if(!$this->hasNext()) {
			$str = trim(fgets(STDIN));
			$this->buf = explode(' ',$str);
			$this->count = count($this->buf);
			$this->pointer = 0;
		}

		return $this->buf[$this->pointer++];
	}

	public function hasNext() {
		return $this->pointer < $this->count;
	}

	public function nextInt() {
		return (int)$this->next();
	}

	public function nextDouble() {
		return (double)$this->next();
	}
}

class Out {
	public function println($str = '') {
		echo $str . PHP_EOL;
	}
}

$in = new In();
$out = new Out();

$N = $in->nextInt();
$A = $in->nextInt();
$B = $in->nextInt();

if ($A > $B) {
	$out->println(0);
	return;
}

if ($N <= 1) {
	if ($A == $B) {
		$out->println(1);
	} else {
		$out->println(0);
	}
	return;
}

$ans = ($N - 2) * ($B - $A) + 1;

$out->println($ans);

?>

Submission Info

Submission Time
Task A - A+...+B Problem
User tookunn
Language Java8 (OpenJDK 1.8.0)
Score 0
Code Size 1161 Byte
Status CE

Compile Error

./Main.java:1: error: class, interface, or enum expected
<?php
^
./Main.java:1: error: class, interface, or enum expected
<?php
 ^
./Main.java:1: error: class, interface, or enum expected
<?php
  ^
./Main.java:5: error: <identifier> expected
	private $buf = [];
	            ^
./Main.java:5: error: illegal start of expression
	private $buf = [];
	               ^
./Main.java:5: error: illegal start of type
	private $buf = [];
	                ^
./Main.java:5: error: <identifier> expected
	private $buf = [];
	                 ^
./Main.java:5: error: ';' expected
	private $buf = [];
	                  ^
./Main.java:6: error: <identifier> expected
	private $count = 0;
	              ^
./Main.java:7: error: <identifier> expected
	private $pointer = 0;
	                ^
./Main.java:10: error: empty character literal
		$ret = '';
		       ^
./Main.java:10: error: unclosed character literal
		$ret = '';
		        ^
./Main.java:10: error: ';' expected
		$ret = '';
		          ^
./Main.java:11: error: not a statement
...