Submission #1603085
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 | PHP7 (7.0.15) |
Score | 200 |
Code Size | 1161 Byte |
Status | AC |
Exec Time | 10 ms |
Memory | 4856 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt, s4.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, s1.txt, s2.txt, s3.txt, s4.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 10 ms | 4728 KB |
02.txt | AC | 9 ms | 4604 KB |
03.txt | AC | 9 ms | 4604 KB |
04.txt | AC | 10 ms | 4856 KB |
05.txt | AC | 9 ms | 4604 KB |
06.txt | AC | 9 ms | 4604 KB |
07.txt | AC | 9 ms | 4604 KB |
08.txt | AC | 9 ms | 4604 KB |
s1.txt | AC | 9 ms | 4604 KB |
s2.txt | AC | 9 ms | 4604 KB |
s3.txt | AC | 9 ms | 4604 KB |
s4.txt | AC | 9 ms | 4604 KB |