Contest Duration: ~ (local time) (110 minutes) Back to Home

Submission #1309988

Source Code Expand

Copy
```#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()

using namespace std;

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, -1, 0, 1 };

int nextInt() {int a; cin >> a; return a;}
char nextChar() {char a; cin >> a; return a;}
double nextDouble() {double a; cin >> a; return a;}
string nextString() {string a; cin >> a; return a;}

template<class T> void inputVector(vector<T>& v, int n) {
v.resize(n);
for (int i = 0; i < v.size(); i++) cin >> v[i];
}

signed main() {
int N, A, B;
cin >> N >> A >> B;

if (A > B) {
cout << 0 << endl;
return 0;
}
if (N == 1) {
cout << (A == B ? 1 : 0) << endl;
return 0;
}

cout << (B * (N - 1) + A) - (A * (N - 1) + B) + 1 << endl;

return 0;
}
```

#### Submission Info

Submission Time 2017-05-27 21:05:06+0900 A - A+...+B Problem iwashi31 C++14 (GCC 5.4.1) 200 1186 Byte AC 1 ms 256 KB

#### Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 s1.txt, s2.txt, s3.txt, s4.txt
All 200 / 200 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 1 ms 256 KB
02.txt 1 ms 256 KB
03.txt 1 ms 256 KB
04.txt 1 ms 256 KB
05.txt 1 ms 256 KB
06.txt 1 ms 256 KB
07.txt 1 ms 256 KB
08.txt 1 ms 256 KB
s1.txt 1 ms 256 KB
s2.txt 1 ms 256 KB
s3.txt 1 ms 256 KB
s4.txt 1 ms 256 KB