Submission #2235573
Source Code Expand
import java.util.Scanner; public class Main { public static void main(String[] args) { final Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long min = sc.nextLong(); long max = sc.nextLong(); if(n==1&&min==max){ System.out.println(1); }else if(min > max || n < 2) { System.out.println(0); } else { System.out.println((max-min)*(n-1)-max+min+1L); } } }
Submission Info
Submission Time | |
---|---|
Task | A - A+...+B Problem |
User | naoppy |
Language | Java8 (OpenJDK 1.8.0) |
Score | 200 |
Code Size | 409 Byte |
Status | AC |
Exec Time | 96 ms |
Memory | 23764 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 | 92 ms | 18768 KB |
02.txt | AC | 94 ms | 19284 KB |
03.txt | AC | 94 ms | 18640 KB |
04.txt | AC | 96 ms | 23764 KB |
05.txt | AC | 92 ms | 18772 KB |
06.txt | AC | 92 ms | 21844 KB |
07.txt | AC | 92 ms | 21716 KB |
08.txt | AC | 92 ms | 18772 KB |
s1.txt | AC | 94 ms | 21076 KB |
s2.txt | AC | 93 ms | 18644 KB |
s3.txt | AC | 94 ms | 21588 KB |
s4.txt | AC | 93 ms | 19796 KB |