output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include<bits/stdc++.h> using namespace std; using ll = long long; int main() { ll n, a, b; cin >> n >> a >> b; cout << max(0LL,(b * (n - 1) + a) - (a * (n - 1) + b) + 1) << endl; }
### Prompt Please formulate a Cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; using ll = long long; int main() { ll n, a, b; cin >> n >> a >> b; cout << max(0LL,(b * (n - 1) + a) - (a * (n - 1) + b) + 1) << endl; } ```
#include <bits/stdc++.h> using namespace std; int main(){ long n, a, b, ans; cin >> n >> a >> b; ans = max((long)0, (b - a) * (n - 2) + 1); cout << ans << endl; }
### Prompt Your task is to create a CPP solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main(){ long n, a, b, ans; cin >> n >> a >> b; ans = max((long)0, (b - a) * (n - 2) + 1); cout << ans << endl; } ```
#include <bits/stdc++.h> using namespace std;int main(){long N,A,B;cin>>N>>A>>B;if(A>B)cout << 0;else if(N==1 && A!=B)cout <<0;else cout<<(N-2)*(B-A)+1;}
### Prompt Generate a Cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std;int main(){long N,A,B;cin>>N>>A>>B;if(A>B)cout << 0;else if(N==1 && A!=B)cout <<0;else cout<<(N-2)*(B-A)+1;} ```
#include<iostream> using namespace std; int main(){ long long a; long long n,b; cin>>n>>a>>b; if(n>1&&b>=a||n==1&&a==b){ cout<<(n-2)*(b-a)+1; return 0; }else{ cout<<"0"; } return 0; }
### Prompt Your task is to create a CPP solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<iostream> using namespace std; int main(){ long long a; long long n,b; cin>>n>>a>>b; if(n>1&&b>=a||n==1&&a==b){ cout<<(n-2)*(b-a)+1; return 0; }else{ cout<<"0"; } return 0; } ```
#include <bits/stdc++.h> using namespace std; int main() { long long N, A, B; cin >> N >> A >> B; cout << max(0LL, (B*(N-1) + A) - (B + A*(N-1)) + 1) << endl; return 0; }
### Prompt Create a solution in CPP for the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { long long N, A, B; cin >> N >> A >> B; cout << max(0LL, (B*(N-1) + A) - (B + A*(N-1)) + 1) << endl; return 0; } ```
#include<bits/stdc++.h> using namespace std; int n,a,b; int main() { cin>>n>>a>>b; if(a>b||(n==1&&a!=b)) puts("0"); else printf("%lld\n",1ll*b*(n-1)+a-1ll*a*(n-1)-b+1); return 0; }
### Prompt Please provide a CPP coded solution to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int n,a,b; int main() { cin>>n>>a>>b; if(a>b||(n==1&&a!=b)) puts("0"); else printf("%lld\n",1ll*b*(n-1)+a-1ll*a*(n-1)-b+1); return 0; } ```
#include<bits/stdc++.h> using namespace std; long long n,a,b; int main() { scanf("%lld%lld%lld",&n,&a,&b); if (n==1) putchar(a==b?'1':'0'); else printf("%lld",b>=a?(n-2)*(b-a)+1:0); return 0; }
### Prompt Your task is to create a Cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; long long n,a,b; int main() { scanf("%lld%lld%lld",&n,&a,&b); if (n==1) putchar(a==b?'1':'0'); else printf("%lld",b>=a?(n-2)*(b-a)+1:0); return 0; } ```
#include<iostream> #include<algorithm> using namespace std; int main(void) { long long n,a,b,c=0; cin >> n >> a >> b; cout << max(c,b*(n-1)+a-(a*(n-1)+b)+1); return 0; }
### Prompt Develop a solution in cpp to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<iostream> #include<algorithm> using namespace std; int main(void) { long long n,a,b,c=0; cin >> n >> a >> b; cout << max(c,b*(n-1)+a-(a*(n-1)+b)+1); return 0; } ```
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll n,a,b; cin>>n>>a>>b; if(n>1 && b>=a || n==1 && a==b) cout<<((n-2)*(b-a)+1); else cout<<'0'; cout<<endl; return 0; }
### Prompt In Cpp, your task is to solve the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll n,a,b; cin>>n>>a>>b; if(n>1 && b>=a || n==1 && a==b) cout<<((n-2)*(b-a)+1); else cout<<'0'; cout<<endl; return 0; } ```
#include <bits/stdc++.h> using namespace std; typedef long long LL; int main() { LL n,a,b; cin >> n >> a >> b; LL ans = n*(b-a)+2*a-2*b+1; ans < 0 ? ans = 0 :0; cout << ans << endl; return 0; }
### Prompt Generate a cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; typedef long long LL; int main() { LL n,a,b; cin >> n >> a >> b; LL ans = n*(b-a)+2*a-2*b+1; ans < 0 ? ans = 0 :0; cout << ans << endl; return 0; } ```
#include<bits/stdc++.h> using namespace std; signed main() {long long N, A, B;cin>>N>>A>>B; cout<<max(0LL, (N-2)*B-(N-2)*A+1)<<endl;}
### Prompt Develop a solution in CPP to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; signed main() {long long N, A, B;cin>>N>>A>>B; cout<<max(0LL, (N-2)*B-(N-2)*A+1)<<endl;} ```
#include <bits/stdc++.h> using namespace std; int main() { long long n,a,b; cin>>n>>a>>b; if(a>b)cout<<0<<endl; else if(n==1&&a!=b)cout<<0<<endl; else cout<<(n-2)*(b-a)+1<<endl; }
### Prompt Your task is to create a Cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { long long n,a,b; cin>>n>>a>>b; if(a>b)cout<<0<<endl; else if(n==1&&a!=b)cout<<0<<endl; else cout<<(n-2)*(b-a)+1<<endl; } ```
#include<bits/stdc++.h> using namespace std; int main(){ long long n,a,b; cin>>n>>a>>b; if(n>1&&b>=a||n==1&&a==b) cout<<(n-2)*(b-a)+1<<endl; else cout<<0<<endl; return 0; }
### Prompt Please provide a Cpp coded solution to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ long long n,a,b; cin>>n>>a>>b; if(n>1&&b>=a||n==1&&a==b) cout<<(n-2)*(b-a)+1<<endl; else cout<<0<<endl; return 0; } ```
#include <bits/stdc++.h> using namespace std; #define ll long long int main(){ ll N,A,B,ans; cin>>N>>A>>B; if(N==1&&A!=B)ans=0; else if(A>B)ans=0; else ans=(B*(N-1)+A)-(A*(N-1)+B)+1; cout<<ans<<endl; }
### Prompt Please formulate a cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; #define ll long long int main(){ ll N,A,B,ans; cin>>N>>A>>B; if(N==1&&A!=B)ans=0; else if(A>B)ans=0; else ans=(B*(N-1)+A)-(A*(N-1)+B)+1; cout<<ans<<endl; } ```
#include<iostream> using namespace std;int main(){long long N,A,B;cin>>N>>A>>B;cout<<max(0LL,(N-2)*(B-A)+1)<<endl;}
### Prompt Please provide a Cpp coded solution to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<iostream> using namespace std;int main(){long long N,A,B;cin>>N>>A>>B;cout<<max(0LL,(N-2)*(B-A)+1)<<endl;} ```
#include <iostream> using namespace std; int main(){ long long n,a,b,ans=0; cin >> n >> a >> b; ans=(b*(n-1)+a)-(a*(n-1)+b)+1; if(ans<0)ans=0; cout << ans << endl; return 0; }
### Prompt Create a solution in CPP for the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <iostream> using namespace std; int main(){ long long n,a,b,ans=0; cin >> n >> a >> b; ans=(b*(n-1)+a)-(a*(n-1)+b)+1; if(ans<0)ans=0; cout << ans << endl; return 0; } ```
#include <cstdio> #include <algorithm> typedef long long int64; int n, a, b; int main() { scanf("%d%d%d", &n, &a, &b); printf("%lld\n", std::max(0LL, (int64)(n - 2) * (b - a) + 1)); return 0; }
### Prompt Please formulate a CPP solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <cstdio> #include <algorithm> typedef long long int64; int n, a, b; int main() { scanf("%d%d%d", &n, &a, &b); printf("%lld\n", std::max(0LL, (int64)(n - 2) * (b - a) + 1)); return 0; } ```
#include<iostream> using namespace std; int main(){ long long n,a,b; cin>>n>>a>>b; if(n>1&&b>=a||n==1&&a==b) cout<<(b-a)*(n-2)+1<<endl; else cout<<0<<endl; return 0; }
### Prompt Develop a solution in cpp to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<iostream> using namespace std; int main(){ long long n,a,b; cin>>n>>a>>b; if(n>1&&b>=a||n==1&&a==b) cout<<(b-a)*(n-2)+1<<endl; else cout<<0<<endl; return 0; } ```
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n,a,b; cin>>n>>a>>b; ll mi = a*(n-1)+b; ll ma = b*(n-1)+a; ll z=0; cout<<max(ma-mi+1,z)<<endl; }
### Prompt Your challenge is to write a cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n,a,b; cin>>n>>a>>b; ll mi = a*(n-1)+b; ll ma = b*(n-1)+a; ll z=0; cout<<max(ma-mi+1,z)<<endl; } ```
#include<bits/stdc++.h> using namespace std; typedef long long l; l max(l a,l b){ if(a>b) return a; else return b; } int main(){ l a,b,c; cin>>a>>b>>c; cout<<max((a-2)*(c-b)+1,0)<<endl; }
### Prompt Generate a cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; typedef long long l; l max(l a,l b){ if(a>b) return a; else return b; } int main(){ l a,b,c; cin>>a>>b>>c; cout<<max((a-2)*(c-b)+1,0)<<endl; } ```
#include<bits/stdc++.h> int n,a,b; int main() { scanf("%d%d%d",&n,&a,&b); printf("%lld\n",std::max((long long)(n-2)*(b-a)+1,0ll)); return 0; }
### Prompt Create a solution in CPP for the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> int n,a,b; int main() { scanf("%d%d%d",&n,&a,&b); printf("%lld\n",std::max((long long)(n-2)*(b-a)+1,0ll)); return 0; } ```
#include<stdio.h> int main(){ long n,a,b,ans; scanf("%ld%ld%ld",&n,&a,&b); if(n==1){ if(a==b) ans=1; else ans=0; } else{ if(a>b) ans=0; else ans=(n-2)*(b-a)+1; } printf("%ld\n",ans); return 0; }
### Prompt Create a solution in Cpp for the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<stdio.h> int main(){ long n,a,b,ans; scanf("%ld%ld%ld",&n,&a,&b); if(n==1){ if(a==b) ans=1; else ans=0; } else{ if(a>b) ans=0; else ans=(n-2)*(b-a)+1; } printf("%ld\n",ans); return 0; } ```
#include<iostream> #include<algorithm> #define LL long long LL N,A,B; int main(){ std::cin>>N>>A>>B; LL ans=(N-2LL)*(B-A)+1; std::cout<<std::max(ans,0LL)<<std::endl; return 0; }
### Prompt In CPP, your task is to solve the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<iostream> #include<algorithm> #define LL long long LL N,A,B; int main(){ std::cin>>N>>A>>B; LL ans=(N-2LL)*(B-A)+1; std::cout<<std::max(ans,0LL)<<std::endl; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main() { long long c,a,b; cin>>c>>a>>b; if(c>1&&b>=a||c==1&&a==b) cout<<(c-2)*(b-a)+1<<endl; else cout<<0<<endl; }
### Prompt Your task is to create a Cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { long long c,a,b; cin>>c>>a>>b; if(c>1&&b>=a||c==1&&a==b) cout<<(c-2)*(b-a)+1<<endl; else cout<<0<<endl; } ```
#include<bits/stdc++.h> using namespace std; using ll = long long; int main() { ll N, A, B; cin>>N>>A>>B; cout<<max(0LL, (N-2)*B-(N-2)*A+1)<<endl; return 0; }
### Prompt Please provide a cpp coded solution to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; using ll = long long; int main() { ll N, A, B; cin>>N>>A>>B; cout<<max(0LL, (N-2)*B-(N-2)*A+1)<<endl; return 0; } ```
#include<bits/stdc++.h> using namespace std; long long n,a,b; int main(){ cin>>n>>a>>b; if(n==1&&a==b||n>1&&a<=b) cout<<(b-a)*(n-2)+1<<endl; else cout<<"0"<<endl; return 0; }
### Prompt Create a solution in cpp for the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; long long n,a,b; int main(){ cin>>n>>a>>b; if(n==1&&a==b||n>1&&a<=b) cout<<(b-a)*(n-2)+1<<endl; else cout<<"0"<<endl; return 0; } ```
#include<cstdio> #include<algorithm> using namespace std; long long n,a,b,ans; int main(){ scanf("%lld%lld%lld",&n,&a,&b); if((b<a)||(n==1&&a!=b))putchar('0'); else printf("%lld",max(0ll,(n-2)*(b-a)+1)); }
### Prompt Your task is to create a Cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<cstdio> #include<algorithm> using namespace std; long long n,a,b,ans; int main(){ scanf("%lld%lld%lld",&n,&a,&b); if((b<a)||(n==1&&a!=b))putchar('0'); else printf("%lld",max(0ll,(n-2)*(b-a)+1)); } ```
#include<cstdio> int main(){ long long int n,a,b; long long int ans=0; scanf("%lld%lld%lld",&n,&a,&b); if(a==b)ans=1; if(a<b){ ans=(b-a)*(n-2)+1; if(n==1)ans=0; } printf("%lld\n",ans); return 0; }
### Prompt Please formulate a Cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<cstdio> int main(){ long long int n,a,b; long long int ans=0; scanf("%lld%lld%lld",&n,&a,&b); if(a==b)ans=1; if(a<b){ ans=(b-a)*(n-2)+1; if(n==1)ans=0; } printf("%lld\n",ans); return 0; } ```
#include <bits/stdc++.h> using namespace std;int main(){long n,a,b;cin>>n>>a>>b;if(n==1&&b-a>=2||a>b){cout<<0;}else{cout<<(n-2)*(b-a)+1;}}
### Prompt Develop a solution in cpp to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std;int main(){long n,a,b;cin>>n>>a>>b;if(n==1&&b-a>=2||a>b){cout<<0;}else{cout<<(n-2)*(b-a)+1;}} ```
#include<bits/stdc++.h> using namespace std; long long n,a,b,sum; int main() { cin>>n>>a>>b; if(n>1&&b>=a) sum=(n-2)*(b-a)+1; if(n==1&&b==a) sum=1; cout<<sum<<endl; return 0; }
### Prompt Please create a solution in Cpp to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; long long n,a,b,sum; int main() { cin>>n>>a>>b; if(n>1&&b>=a) sum=(n-2)*(b-a)+1; if(n==1&&b==a) sum=1; cout<<sum<<endl; return 0; } ```
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll N, A, B;cin >> N >> A >> B; cout<<max((B * (N - 1) + A) - (A * (N - 1) + B) + 1, 0LL)<<endl; return 0; }
### Prompt Your challenge is to write a Cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll N, A, B;cin >> N >> A >> B; cout<<max((B * (N - 1) + A) - (A * (N - 1) + B) + 1, 0LL)<<endl; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main(){ long long n,a,b; cin>>n>>a>>b; cout<<max((n-2)*(b-a)+1,(long long)0)<<endl; return(0); }
### Prompt Please provide a cpp coded solution to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ long long n,a,b; cin>>n>>a>>b; cout<<max((n-2)*(b-a)+1,(long long)0)<<endl; return(0); } ```
#include<stdio.h> int main(){ long long a,a1,a2; scanf("%lld %lld %lld",&a,&a1,&a2); long long t = a1+(a-1)*a2-(a1*(a-1)+a2); if(t>=0){ printf("%lld\n",t+1); } else printf("0\n"); }
### Prompt Construct a CPP code solution to the problem outlined: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<stdio.h> int main(){ long long a,a1,a2; scanf("%lld %lld %lld",&a,&a1,&a2); long long t = a1+(a-1)*a2-(a1*(a-1)+a2); if(t>=0){ printf("%lld\n",t+1); } else printf("0\n"); } ```
#include<bits/stdc++.h> using namespace std; using ll=long long; ll N,A,B; int main(){ cin>>N>>A>>B;--N; cout<<max(0ll,(B-A)*N+A-B+1)<<endl; }
### Prompt In Cpp, your task is to solve the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; using ll=long long; ll N,A,B; int main(){ cin>>N>>A>>B;--N; cout<<max(0ll,(B-A)*N+A-B+1)<<endl; } ```
#include<bits/stdc++.h> using namespace std; int main(){ long long n, a, b; cin >> n >> a >> b; cout << max(0LL, (2 - n) * (a - b) + 1LL) << endl; return 0; }
### Prompt Your task is to create a cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ long long n, a, b; cin >> n >> a >> b; cout << max(0LL, (2 - n) * (a - b) + 1LL) << endl; return 0; } ```
#include <iostream> using namespace std; int main() { long N, A, B; cin >> N >> A >> B; cout << max(((N - 1) * B + A) - ((N - 1) * A + B) + 1, 0L) << endl; return 0; }
### Prompt Please formulate a CPP solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <iostream> using namespace std; int main() { long N, A, B; cin >> N >> A >> B; cout << max(((N - 1) * B + A) - ((N - 1) * A + B) + 1, 0L) << endl; return 0; } ```
#include <bits/stdc++.h> using namespace std; int main(){ long long n, a, b; cin >> n >> a >> b; cout << max(b * (n - 1) + a - (a * (n - 1) + b) + 1, 0 * 1LL); }
### Prompt In Cpp, your task is to solve the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main(){ long long n, a, b; cin >> n >> a >> b; cout << max(b * (n - 1) + a - (a * (n - 1) + b) + 1, 0 * 1LL); } ```
#include<bits/stdc++.h> using namespace std; int main(){ long long n,a,b; cin>>n>>a>>b; if(a>b)return 0*printf("0"); if(n==1)return 0*printf("%d",a==b?1:0); cout<<(n-2)*(b-a)+1; return 0; }
### Prompt Develop a solution in CPP to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ long long n,a,b; cin>>n>>a>>b; if(a>b)return 0*printf("0"); if(n==1)return 0*printf("%d",a==b?1:0); cout<<(n-2)*(b-a)+1; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main() { long long n,a,b; cin>>n>>a>>b; if(n>1&&b>=a||n==1&&a==b) cout<<(n-2)*(b-a)+1; else cout<<0; return 0; }
### Prompt In cpp, your task is to solve the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { long long n,a,b; cin>>n>>a>>b; if(n>1&&b>=a||n==1&&a==b) cout<<(n-2)*(b-a)+1; else cout<<0; return 0; } ```
#include <bits/stdc++.h> using namespace std; long long n,a,b; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin>>n>>a>>b; long long zero =0; cout<<max(zero,(n-((a==b)?1:2))*(b-a) +1)<<endl; }
### Prompt Develop a solution in cpp to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; long long n,a,b; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin>>n>>a>>b; long long zero =0; cout<<max(zero,(n-((a==b)?1:2))*(b-a) +1)<<endl; } ```
#include<bits/stdc++.h> /* */ using namespace std; int main() { long long int N, A, B; cin >> N >> A >> B; cout << max( 0LL, ( ( N - 1 )*B + A ) - ( ( N - 1 )*A + B ) + 1 ) << endl; }
### Prompt Generate a Cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> /* */ using namespace std; int main() { long long int N, A, B; cin >> N >> A >> B; cout << max( 0LL, ( ( N - 1 )*B + A ) - ( ( N - 1 )*A + B ) + 1 ) << endl; } ```
#include<stdio.h> int main(){ int n,a,b; scanf("%d%d%d",&n,&a,&b); if(a>b||(n==1&&b!=a)){ printf("0"); }else{ printf("%lld\n",(long long )(b-a)*(n-2)+1); } }
### Prompt Please create a solution in Cpp to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<stdio.h> int main(){ int n,a,b; scanf("%d%d%d",&n,&a,&b); if(a>b||(n==1&&b!=a)){ printf("0"); }else{ printf("%lld\n",(long long )(b-a)*(n-2)+1); } } ```
#include<bits/stdc++.h> using namespace std; int main(){ long long n,x,y; cin>>n>>x>>y; if((n>1&&y>=x)||(n==1&&x==y)){ cout<<(n-2)*(y-x)+1<<endl; } else cout<<0<<endl; return 0; }
### Prompt Please formulate a cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ long long n,x,y; cin>>n>>x>>y; if((n>1&&y>=x)||(n==1&&x==y)){ cout<<(n-2)*(y-x)+1<<endl; } else cout<<0<<endl; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main(){ long long n,a,b; cin>>n>>a>>b; long long mn=(n-1)*a+b; long long mx=(n-1)*b+a; cout<<max(mx-mn+1,0ll); } //solved problems for today:2
### Prompt Your task is to create a CPP solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ long long n,a,b; cin>>n>>a>>b; long long mn=(n-1)*a+b; long long mx=(n-1)*b+a; cout<<max(mx-mn+1,0ll); } //solved problems for today:2 ```
#include<bits/stdc++.h> using namespace std; int main(){ long N,A,B,ans;cin>>N>>A>>B; if(A>B)ans=0; else if(A==B)ans=1; else if(N==1)ans=0; else ans=(B-A)*(N-2)+1; cout<<ans<<endl; }
### Prompt In cpp, your task is to solve the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ long N,A,B,ans;cin>>N>>A>>B; if(A>B)ans=0; else if(A==B)ans=1; else if(N==1)ans=0; else ans=(B-A)*(N-2)+1; cout<<ans<<endl; } ```
#include <iostream> using namespace std; typedef long long ll; ll a,b,n; int main(){ cin >> n >> a >> b; cout << max(0LL,(b*(n-1)+a-(a*(n-1)+b))+1) << endl; return 0; }
### Prompt Develop a solution in Cpp to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <iostream> using namespace std; typedef long long ll; ll a,b,n; int main(){ cin >> n >> a >> b; cout << max(0LL,(b*(n-1)+a-(a*(n-1)+b))+1) << endl; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main(){ long long int n,a,b; cin>>n>>a>>b; if(a>b||(n==1&&a<b)) cout<<0<<endl; else cout<<a+(n-1)*b-1*((n-1)*a+b)+1<<endl; }
### Prompt In cpp, your task is to solve the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ long long int n,a,b; cin>>n>>a>>b; if(a>b||(n==1&&a<b)) cout<<0<<endl; else cout<<a+(n-1)*b-1*((n-1)*a+b)+1<<endl; } ```
#include<iostream> using namespace std; int main(){ long long int N,A,B; cin>>N>>A>>B; cout<<max(0LL,(N-2)*(B-A)+1)<<endl; }
### Prompt Create a solution in CPP for the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<iostream> using namespace std; int main(){ long long int N,A,B; cin>>N>>A>>B; cout<<max(0LL,(N-2)*(B-A)+1)<<endl; } ```
#include <bits/stdc++.h> #include <assert.h> using namespace std; int main() { long long n, a, b; cin >> n >> a >> b; cout << max((long long)0, (n - 2) * b - (n - 2) * a + 1) << endl; return 0; }
### Prompt Please create a solution in Cpp to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> #include <assert.h> using namespace std; int main() { long long n, a, b; cin >> n >> a >> b; cout << max((long long)0, (n - 2) * b - (n - 2) * a + 1) << endl; return 0; } ```
#include<iostream> using namespace std; int main() { long long n,a,b; cin>>n>>a>>b; if((n>1&&b>=a)||(n==1&&a==b)) cout<<(b-a)*(n-2)+1<<endl; else cout<<"0\n"; return 0; }
### Prompt Generate a Cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<iostream> using namespace std; int main() { long long n,a,b; cin>>n>>a>>b; if((n>1&&b>=a)||(n==1&&a==b)) cout<<(b-a)*(n-2)+1<<endl; else cout<<"0\n"; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main(){ long n,a,b; cin >> n >> a >> b; if( a>b || n==1 && a!=b) { cout << 0 << endl; return 0; } cout << (n-2)*(b-a)+1 <<endl; }
### Prompt Please provide a Cpp coded solution to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ long n,a,b; cin >> n >> a >> b; if( a>b || n==1 && a!=b) { cout << 0 << endl; return 0; } cout << (n-2)*(b-a)+1 <<endl; } ```
#include<bits/stdc++.h> using namespace std; int n,A,B; int main() { cin>>n>>A>>B; if(A>B||(n==1&&A!=B)) puts("0"); else cout<<(n-2ll)*(B-A)+1<<endl; return 0; }
### Prompt Develop a solution in CPP to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int n,A,B; int main() { cin>>n>>A>>B; if(A>B||(n==1&&A!=B)) puts("0"); else cout<<(n-2ll)*(B-A)+1<<endl; return 0; } ```
#include<bits/stdc++.h> using namespace std; #define int long long signed main(){ int N,A,B; cin>>N>>A>>B; cout<<max(0LL,(A+B*(N-1))-(A*(N-1)+B)+1)<<endl; }
### Prompt In CPP, your task is to solve the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; #define int long long signed main(){ int N,A,B; cin>>N>>A>>B; cout<<max(0LL,(A+B*(N-1))-(A*(N-1)+B)+1)<<endl; } ```
#include <iostream> using namespace std; int main(){ long n, a, b; cin >> n >> a >> b; if(a>b){ cout << 0; return 0; } long ret=(b-a)*(n-2)+1; cout << (ret>0 ? ret : 0); return 0; }
### Prompt Please provide a Cpp coded solution to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <iostream> using namespace std; int main(){ long n, a, b; cin >> n >> a >> b; if(a>b){ cout << 0; return 0; } long ret=(b-a)*(n-2)+1; cout << (ret>0 ? ret : 0); return 0; } ```
#include <bits/stdc++.h> using namespace std; int main() { int64_t N,A,B; cin>>N>>A>>B; if(A>B||(N==1&&A!=B)){ cout<<"0"<<endl; } else{ cout<<1+(N-2)*(B-A)<<endl; } }
### Prompt In Cpp, your task is to solve the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { int64_t N,A,B; cin>>N>>A>>B; if(A>B||(N==1&&A!=B)){ cout<<"0"<<endl; } else{ cout<<1+(N-2)*(B-A)<<endl; } } ```
#include<iostream> using namespace std; long long n,a,b,l,r; int main() { cin>>n>>a>>b; if(a>b){puts("0");return 0;} l=b+(n-1)*a,r=a+(n-1)*b; cout<<max(0ll,r-l+1)<<endl; return 0; }
### Prompt Construct a CPP code solution to the problem outlined: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<iostream> using namespace std; long long n,a,b,l,r; int main() { cin>>n>>a>>b; if(a>b){puts("0");return 0;} l=b+(n-1)*a,r=a+(n-1)*b; cout<<max(0ll,r-l+1)<<endl; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n,a,b; cin>>n>>a>>b; cout<<max(0ll,(n-1)*b+a-(n-1)*a-b+1)<<endl; }
### Prompt Please provide a CPP coded solution to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n,a,b; cin>>n>>a>>b; cout<<max(0ll,(n-1)*b+a-(n-1)*a-b+1)<<endl; } ```
#include<cstdio> #include<iostream> using namespace std; int n,a,b; int main(){ cin>>n>>a>>b; cout<<((n>1&&b>=a||n==1&&a==b)?(1ll*(n-2)*(b-a)+1):0); return 0; }
### Prompt Please provide a cpp coded solution to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<cstdio> #include<iostream> using namespace std; int n,a,b; int main(){ cin>>n>>a>>b; cout<<((n>1&&b>=a||n==1&&a==b)?(1ll*(n-2)*(b-a)+1):0); return 0; } ```
#include<cstdio> int main(){ long long n,a,b; scanf("%lld%lld%lld",&n,&a,&b); if(a > b) return 0*printf("0\n"); if(n == 1 && a < b) return 0*printf("0\n"); printf("%lld\n",a+b*(n-1)-(b+a*(n-1))+1); return 0; }
### Prompt In CPP, your task is to solve the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<cstdio> int main(){ long long n,a,b; scanf("%lld%lld%lld",&n,&a,&b); if(a > b) return 0*printf("0\n"); if(n == 1 && a < b) return 0*printf("0\n"); printf("%lld\n",a+b*(n-1)-(b+a*(n-1))+1); return 0; } ```
#include <iostream> int main() { long N, A, B; std::cin >> N >> A >> B; std::cout << std::max( (long)0, ( A + B * ( N - 1 ) ) - ( A * ( N - 1 ) + B ) + 1 ) << std::endl; return 0; }
### Prompt Your challenge is to write a Cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <iostream> int main() { long N, A, B; std::cin >> N >> A >> B; std::cout << std::max( (long)0, ( A + B * ( N - 1 ) ) - ( A * ( N - 1 ) + B ) + 1 ) << std::endl; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main(){ long int n,a,b;cin>>n>>a>>b; if(n==1&&a==b)cout<<1<<endl; else if(n==1||b<a)cout<<0<<endl; else cout<<b*(n-2)-a*(n-2)+1<<endl; }
### Prompt Create a solution in cpp for the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ long int n,a,b;cin>>n>>a>>b; if(n==1&&a==b)cout<<1<<endl; else if(n==1||b<a)cout<<0<<endl; else cout<<b*(n-2)-a*(n-2)+1<<endl; } ```
#include<bits/stdc++.h> using namespace std; int main() { long long n,A,B; cin>>n>>A>>B; cout<<max(0ll,(n-2)*(B-A)+1)<<endl; }
### Prompt Your challenge is to write a Cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { long long n,A,B; cin>>n>>A>>B; cout<<max(0ll,(n-2)*(B-A)+1)<<endl; } ```
#include <iostream> using namespace std; int main(){ long long N,A,B; cin>>N>>A>>B; if (A>B) cout << 0 << endl; else if (N==1) cout <<(A==B ? 1:0) <<endl; else cout <<(N-2)*(B-A)+1 <<endl; }
### Prompt Please create a solution in CPP to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <iostream> using namespace std; int main(){ long long N,A,B; cin>>N>>A>>B; if (A>B) cout << 0 << endl; else if (N==1) cout <<(A==B ? 1:0) <<endl; else cout <<(N-2)*(B-A)+1 <<endl; } ```
#include<iostream> using namespace std; int main() { long long jj,a,b; cin>>jj>>a>>b; if(jj>1&&b>=a||jj==1&&a==b) cout<<(jj-2)*(b-a)+1<<endl; else cout<<0<<endl; }
### Prompt Your challenge is to write a Cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<iostream> using namespace std; int main() { long long jj,a,b; cin>>jj>>a>>b; if(jj>1&&b>=a||jj==1&&a==b) cout<<(jj-2)*(b-a)+1<<endl; else cout<<0<<endl; } ```
#include<bits/stdc++.h> using namespace std; #define ll long long int main(){ ll n,a,b; cin >> n >> a >> b; cout << max((b*(n-1)+a) - (a*(n-1)+b) + 1, (ll)0) << endl; }
### Prompt Generate a cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; #define ll long long int main(){ ll n,a,b; cin >> n >> a >> b; cout << max((b*(n-1)+a) - (a*(n-1)+b) + 1, (ll)0) << endl; } ```
#include <stdio.h> int main(){ int n,A,B; scanf("%d%d%d",&n,&A,&B); if(A>B){puts("0");return 0;} if(n==1){printf("%d\n",A==B);return 0;} long long s=(n-1)*1ll*A+B,t=(n-1)*1ll*B+A; printf("%lld\n",t-s+1); }
### Prompt Your task is to create a cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <stdio.h> int main(){ int n,A,B; scanf("%d%d%d",&n,&A,&B); if(A>B){puts("0");return 0;} if(n==1){printf("%d\n",A==B);return 0;} long long s=(n-1)*1ll*A+B,t=(n-1)*1ll*B+A; printf("%lld\n",t-s+1); } ```
#include<iostream> using namespace std; long long n,a,b; int main() { cin>>n>>a>>b; if(n>1&&b>=a||n==1&&a==b) cout<<(n-2)*(b-a)+1<<endl; else cout<<"0"<<endl; } //lx好帅
### Prompt Your challenge is to write a Cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<iostream> using namespace std; long long n,a,b; int main() { cin>>n>>a>>b; if(n>1&&b>=a||n==1&&a==b) cout<<(n-2)*(b-a)+1<<endl; else cout<<"0"<<endl; } //lx好帅 ```
#include <iostream> #include <algorithm> using namespace std; int main() { long long N, A, B; cin >> N >> A >> B; cout << max(0ll, (B - A) * (N - 2) + 1) << endl; }
### Prompt Please formulate a CPP solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <iostream> #include <algorithm> using namespace std; int main() { long long N, A, B; cin >> N >> A >> B; cout << max(0ll, (B - A) * (N - 2) + 1) << endl; } ```
#include <bits/stdc++.h> using namespace std; int main() { // your code goes here long long n,a,b; cin >> n >> a >> b; cout << max(0ll,(b-a)*(n-2)+1) << endl; return 0; }
### Prompt Generate a Cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { // your code goes here long long n,a,b; cin >> n >> a >> b; cout << max(0ll,(b-a)*(n-2)+1) << endl; return 0; } ```
#include <iostream> using namespace std; #define int long long signed main() { int n,a,b; cin >> n >> a >> b; int ans = (n-2)*(b-a) + 1; int fuck = 0; cout << max(ans,fuck); return 0; }
### Prompt Please create a solution in Cpp to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <iostream> using namespace std; #define int long long signed main() { int n,a,b; cin >> n >> a >> b; int ans = (n-2)*(b-a) + 1; int fuck = 0; cout << max(ans,fuck); return 0; } ```
#include<bits/stdc++.h> using namespace std; int main(){ long long a,b,c; cin>>a>>b>>c; if(b>c||(a==1&&b!=c)) cout<<0; else{ cout<<(c*(a-1)+b)-(c+b*(a-1))+1; } }
### Prompt Your challenge is to write a cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ long long a,b,c; cin>>a>>b>>c; if(b>c||(a==1&&b!=c)) cout<<0; else{ cout<<(c*(a-1)+b)-(c+b*(a-1))+1; } } ```
#include <iostream> #include <algorithm> using namespace std; using ll = long long; int main() { ll N, A, B; cin >> N >> A >> B; cout << max(0LL, (B - A) * (N - 2) + 1) << endl; }
### Prompt Please provide a Cpp coded solution to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <iostream> #include <algorithm> using namespace std; using ll = long long; int main() { ll N, A, B; cin >> N >> A >> B; cout << max(0LL, (B - A) * (N - 2) + 1) << endl; } ```
#include<iostream> using namespace std; int main(){ long long n,a,b; cin>>n>>a>>b; cout<<((n!=1)?(a>b?0:1+(n-2)*(b-a)):(a==b)?1:0); }
### Prompt In Cpp, your task is to solve the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<iostream> using namespace std; int main(){ long long n,a,b; cin>>n>>a>>b; cout<<((n!=1)?(a>b?0:1+(n-2)*(b-a)):(a==b)?1:0); } ```
#include <bits/stdc++.h> using namespace std; long long n, a, b, result; int main() { cin >> n >> a >> b; result = (n-2)*(b-a); if (result >= 0) result += 1; else result = 0; cout << result << endl; }
### Prompt In cpp, your task is to solve the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; long long n, a, b, result; int main() { cin >> n >> a >> b; result = (n-2)*(b-a); if (result >= 0) result += 1; else result = 0; cout << result << endl; } ```
#include <bits/stdc++.h> using namespace std; int main(void){ long long N,A,B; cin>>N>>A>>B; if(A==B)cout<<1<<endl; else if(A>B || N==1)cout<<0<<endl; else cout<<(B-A)*(N-2)+1<<endl; return 0; }
### Prompt Create a solution in CPP for the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main(void){ long long N,A,B; cin>>N>>A>>B; if(A==B)cout<<1<<endl; else if(A>B || N==1)cout<<0<<endl; else cout<<(B-A)*(N-2)+1<<endl; return 0; } ```
#include <bits/stdc++.h> using namespace std; long long n,a,b; int main(){ cin>>n>>a>>b; cout << (a>b?0:n==1?a==b?1:0:(b-a)*(n-2)+1) << endl; return 0; }
### Prompt Your challenge is to write a cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; long long n,a,b; int main(){ cin>>n>>a>>b; cout << (a>b?0:n==1?a==b?1:0:(b-a)*(n-2)+1) << endl; return 0; } ```
#include <algorithm> #include <iostream> using namespace std; int main() { long N, A, B; cin >> N >> A >> B; cout << max((N - 1) * B + 1 + A - (N - 1) * A - B, 0l); }
### Prompt Your challenge is to write a CPP solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <algorithm> #include <iostream> using namespace std; int main() { long N, A, B; cin >> N >> A >> B; cout << max((N - 1) * B + 1 + A - (N - 1) * A - B, 0l); } ```
#include <cstdio> int main(){ long long n,a,b; scanf("%lld%lld%lld",&n,&a,&b); if(n>1&&b>=a||n==1&&a==b) printf("%lld",(b-a)*(n-2)+1); else printf("0"); return 0; }
### Prompt Please provide a cpp coded solution to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <cstdio> int main(){ long long n,a,b; scanf("%lld%lld%lld",&n,&a,&b); if(n>1&&b>=a||n==1&&a==b) printf("%lld",(b-a)*(n-2)+1); else printf("0"); return 0; } ```
#include<bits/stdc++.h> using namespace std; int main() { int n, a, b; cin >> n >> a >> b; long long h = n - 1; cout << max(0LL, b * h + a - a * h - b + 1) << '\n'; }
### Prompt Generate a CPP solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { int n, a, b; cin >> n >> a >> b; long long h = n - 1; cout << max(0LL, b * h + a - a * h - b + 1) << '\n'; } ```
#include <bits/stdc++.h> using namespace std; int main(){ int64_t n, a, b; cin >> n >> a >> b; int64_t ans = (n - 1) * b + a - ((n - 1) * a + b) + 1; cout << max(0L, ans) << endl; }
### Prompt Please formulate a Cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main(){ int64_t n, a, b; cin >> n >> a >> b; int64_t ans = (n - 1) * b + a - ((n - 1) * a + b) + 1; cout << max(0L, ans) << endl; } ```
#include<iostream> using namespace std; int main(){ long long n,a,b,c,d,e;cin >> n >> a >> b; c = n*a+(b-a);d = n*b-(b-a);e = d-c+1; if(e<0) e=0; cout << e << endl; }
### Prompt Please formulate a cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<iostream> using namespace std; int main(){ long long n,a,b,c,d,e;cin >> n >> a >> b; c = n*a+(b-a);d = n*b-(b-a);e = d-c+1; if(e<0) e=0; cout << e << endl; } ```
#include<cstdio> long long n,a,b; int main(){ scanf("%lld %lld %lld",&n,&a,&b); if(n>1&&b>=a||(n==1&&a==b))printf("%lld\n",a+b*(n-1)-(b+a*(n-1))+1); else printf("0\n"); return 0; }
### Prompt Please formulate a cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<cstdio> long long n,a,b; int main(){ scanf("%lld %lld %lld",&n,&a,&b); if(n>1&&b>=a||(n==1&&a==b))printf("%lld\n",a+b*(n-1)-(b+a*(n-1))+1); else printf("0\n"); return 0; } ```
#include <iostream> using namespace std; int main() { long long n, a, b; cin >> n >> a >> b; cout << max((n - 1) * b + a - (n - 1) * a - b + 1, 0ll); return 0; }
### Prompt Create a solution in CPP for the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <iostream> using namespace std; int main() { long long n, a, b; cin >> n >> a >> b; cout << max((n - 1) * b + a - (n - 1) * a - b + 1, 0ll); return 0; } ```
#include<iostream> using namespace std; long long n,a,b; int main() { cin>>n>>a>>b; long long mn=a*(n-1)+b,mx=b*(n-1)+a; cout<<((a>b||(n==1&&a!=b))?0:mx-mn+1); return 0; }
### Prompt Please create a solution in cpp to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<iostream> using namespace std; long long n,a,b; int main() { cin>>n>>a>>b; long long mn=a*(n-1)+b,mx=b*(n-1)+a; cout<<((a>b||(n==1&&a!=b))?0:mx-mn+1); return 0; } ```
#include <iostream> using namespace std; int main(){ long long N,A,B,an;cin>>N>>A>>B; an= A>B?0:N==1?A!=B?0:1:(B-A)*(N-2)+1; cout <<an; }
### Prompt Your challenge is to write a cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <iostream> using namespace std; int main(){ long long N,A,B,an;cin>>N>>A>>B; an= A>B?0:N==1?A!=B?0:1:(B-A)*(N-2)+1; cout <<an; } ```
#include<bits/stdc++.h> using namespace std; #define ll long long int main(){ ll n,a,b; cin >> n >> a >> b; if((n==1&&a!=b)||a>b){ cout << 0 << endl; }else{ cout << (n-2)*(b-a)+1 << endl; } }
### Prompt Generate a CPP solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; #define ll long long int main(){ ll n,a,b; cin >> n >> a >> b; if((n==1&&a!=b)||a>b){ cout << 0 << endl; }else{ cout << (n-2)*(b-a)+1 << endl; } } ```
#include <bits/stdc++.h> using namespace std; int main() { long long x,a,b; cin>>x>>a>>b; if(x>1&&b>=a||x==1&&a==b) { cout<<(x-2)*(b-a)+1<<endl; } else { cout<<0<<endl; } return 0; }
### Prompt Construct a CPP code solution to the problem outlined: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { long long x,a,b; cin>>x>>a>>b; if(x>1&&b>=a||x==1&&a==b) { cout<<(x-2)*(b-a)+1<<endl; } else { cout<<0<<endl; } return 0; } ```
#include <bits/stdc++.h> using namespace std; int main(){ long long n,a,b; cin >> n >> a >> b; if((n==1&&b-a>=2) || a>b){ cout << 0 << endl; } else{ cout << (n-2)*(b-a)+1 << endl; } }
### Prompt Please formulate a Cpp solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main(){ long long n,a,b; cin >> n >> a >> b; if((n==1&&b-a>=2) || a>b){ cout << 0 << endl; } else{ cout << (n-2)*(b-a)+1 << endl; } } ```
#include <bits/stdc++.h> using namespace std; int main() { long long n,a,b; cin>>n>>a>>b; long long kotae=max((n-2)*b-(n-2)*a+1,0LL); cout<<kotae<<endl; }
### Prompt Develop a solution in Cpp to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { long long n,a,b; cin>>n>>a>>b; long long kotae=max((n-2)*b-(n-2)*a+1,0LL); cout<<kotae<<endl; } ```
#include<iostream> using namespace std; long long int n,a,b,c, rs; int main() { rs=0; cin>>n>>a>>b; if(n==1&a==b)rs=1; else if(n>1&&a<=b) { rs=(n-2)*(b-a)+1; } cout<<rs<<endl; }
### Prompt Please provide a Cpp coded solution to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<iostream> using namespace std; long long int n,a,b,c, rs; int main() { rs=0; cin>>n>>a>>b; if(n==1&a==b)rs=1; else if(n>1&&a<=b) { rs=(n-2)*(b-a)+1; } cout<<rs<<endl; } ```
#include <bits/stdc++.h> using namespace std; int main() { long N, A, B; cin >> N >> A >> B; if (B < A || N == 1 && A != B) cout << 0 << endl; else cout << (B - A) * (N - 2) + 1 << endl; }
### Prompt Generate a CPP solution to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { long N, A, B; cin >> N >> A >> B; if (B < A || N == 1 && A != B) cout << 0 << endl; else cout << (B - A) * (N - 2) + 1 << endl; } ```
#include<iostream> using namespace std; int main(){ long long n,a,b; cin >> n >> a >> b; if((a>b)||(n==1&&a!=b)) cout << 0 << endl; else cout << (b-a)*(n-2)+1 << endl; }
### Prompt Develop a solution in Cpp to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<iostream> using namespace std; int main(){ long long n,a,b; cin >> n >> a >> b; if((a>b)||(n==1&&a!=b)) cout << 0 << endl; else cout << (b-a)*(n-2)+1 << endl; } ```
#include <bits/stdc++.h> using namespace std; using LLI = long long int; LLI a, b, n; int main() { scanf("%lld%lld%lld", &n, &a, &b); printf("%lld\n", max(0LL, (b*(n-1))+a-(a*(n-1)+b)+1)); }
### Prompt Develop a solution in cpp to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; using LLI = long long int; LLI a, b, n; int main() { scanf("%lld%lld%lld", &n, &a, &b); printf("%lld\n", max(0LL, (b*(n-1))+a-(a*(n-1)+b)+1)); } ```
#include <iostream> using namespace std; typedef long long ll; ll n,a,b; int main(){ cin>>n>>a>>b; if((n>1&&b>=a)||(n==1&&a==b))cout<<(n-2)*(b-a)+1<<endl; else cout<<0<<endl; return 0; }
### Prompt Please provide a cpp coded solution to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <iostream> using namespace std; typedef long long ll; ll n,a,b; int main(){ cin>>n>>a>>b; if((n>1&&b>=a)||(n==1&&a==b))cout<<(n-2)*(b-a)+1<<endl; else cout<<0<<endl; return 0; } ```
#include <bits/stdc++.h> using namespace std; int main() { long long n, a, b; cin >> n >> a >> b; cout << (a > b || (n == 1 && a - b) ? 0 : (b - a) * (n - 2) + 1) << endl; return 0; }
### Prompt Develop a solution in cpp to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { long long n, a, b; cin >> n >> a >> b; cout << (a > b || (n == 1 && a - b) ? 0 : (b - a) * (n - 2) + 1) << endl; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main(){ long n,a,b; cin>>n>>a>>b; cout<<(b<a||a<b&&n<2?0:(b-a)*(n-2)+1); }
### Prompt Please create a solution in Cpp to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main(){ long n,a,b; cin>>n>>a>>b; cout<<(b<a||a<b&&n<2?0:(b-a)*(n-2)+1); } ```
#include <bits/stdc++.h> using namespace std; int main() { long long n,a,b; cin >> n >> a >> b; if((n==1 && a!=b) || a>b){ cout << 0 << endl; return 0; } cout << (b-a)*(n-2)+1 << endl; }
### Prompt Construct a cpp code solution to the problem outlined: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <bits/stdc++.h> using namespace std; int main() { long long n,a,b; cin >> n >> a >> b; if((n==1 && a!=b) || a>b){ cout << 0 << endl; return 0; } cout << (b-a)*(n-2)+1 << endl; } ```
#include <iostream> using namespace std; int main(int argc, char const *argv[]) { long long n,a,b; cin >> n >> a >> b; cout << max(b*(n-1)+a-a*(n-1)-b+1,(long long)0) << endl; return 0; }
### Prompt Create a solution in CPP for the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <iostream> using namespace std; int main(int argc, char const *argv[]) { long long n,a,b; cin >> n >> a >> b; cout << max(b*(n-1)+a-a*(n-1)-b+1,(long long)0) << endl; return 0; } ```
#include<bits/stdc++.h> using namespace std; int main() { long long n,a,b; cin>>n>>a>>b; if(n>1&&b>=a||n==1&&a==b) cout<<(n-1)*(b-a)+a-b+1<<endl; else cout<<0<<endl; }
### Prompt Develop a solution in Cpp to the problem described below: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include<bits/stdc++.h> using namespace std; int main() { long long n,a,b; cin>>n>>a>>b; if(n>1&&b>=a||n==1&&a==b) cout<<(n-1)*(b-a)+a-b+1<<endl; else cout<<0<<endl; } ```
#include <iostream> using namespace std; int main() { long long N,A,B; cin >> N >> A >> B; if(N==1 && A!=B) cout << 0 << '\n'; else if(A > B) cout << 0 << '\n'; else cout << (N-2)*(B-A)+1 << '\n'; }
### Prompt Please create a solution in CPP to the following problem: Snuke has N integers. Among them, the smallest is A, and the largest is B. We are interested in the sum of those N integers. How many different possible sums there are? Constraints * 1 ≤ N,A,B ≤ 10^9 * A and B are integers. Input Input is given from Standard Input in the following format: N A B Output Print the number of the different possible sums. Examples Input 4 4 6 Output 5 Input 5 4 3 Output 0 Input 1 7 10 Output 0 Input 1 3 3 Output 1 ### Response ```cpp #include <iostream> using namespace std; int main() { long long N,A,B; cin >> N >> A >> B; if(N==1 && A!=B) cout << 0 << '\n'; else if(A > B) cout << 0 << '\n'; else cout << (N-2)*(B-A)+1 << '\n'; } ```