Submission #1800631
Source Code Expand
use std::io; fn next_vec() -> Vec<i64> { let mut buf = String::new(); io::stdin().read_line(&mut buf).unwrap(); buf.split_whitespace().map(|n| n.parse().unwrap()).collect() } fn main() { let v = next_vec(); let n = v[0]; let a = v[1]; let b = v[2]; let minimum = a * (n - 1) + b; let maximum = a + b * (n - 1); let ans = maximum - minimum + 1; println!("{:?}", if ans < 0 {0} else {ans}); }
Submission Info
Submission Time | |
---|---|
Task | A - A+...+B Problem |
User | nicklaw296 |
Language | Rust (1.15.1) |
Score | 200 |
Code Size | 457 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 4352 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 | 2 ms | 4352 KB |
02.txt | AC | 2 ms | 4352 KB |
03.txt | AC | 2 ms | 4352 KB |
04.txt | AC | 2 ms | 4352 KB |
05.txt | AC | 2 ms | 4352 KB |
06.txt | AC | 2 ms | 4352 KB |
07.txt | AC | 2 ms | 4352 KB |
08.txt | AC | 2 ms | 4352 KB |
s1.txt | AC | 2 ms | 4352 KB |
s2.txt | AC | 2 ms | 4352 KB |
s3.txt | AC | 2 ms | 4352 KB |
s4.txt | AC | 2 ms | 4352 KB |