Algorithm


problem link- https://www.spoj.com/problems/EMP/

EMP - University Employees

no tags 

 

On some island each inhabitant is either a knight who only tells the truth, or a liar who always lies. Also, on the island there exists a university of technology where some of the inhabitants work. All of the university employees will always tell you the following two things, no matter which employee you ask:

1. There are fewer than N employees who work more than me.


2. At least M employees of the university have a larger salary than me.


It is also known that no two employees of the university have an identical salary, and no two work equally. Write a program which will compute how many persons are employed by this university.

Input

The only input line contains two integers N and M, with one space between them [N, M <= 1000000000].

Output

The output must contain only one integer - the total number of employees of this university, or 0 if there is no way to find the number of employees.

Example

Input:
1 1

Output:
2

Author: Filimonenkov D.O.

 

Code Examples

#1 Code Example with C++ Programming

Code - C++ Programming

#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <map>
#include <list>

using namespace std;

int main(){
	long n,m;
	scanf("%ld%ld",&n,&m);
	printf("%ld",n+m);
	return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
1 1

Output

x
+
cmd
2
Advertisements

Demonstration


SPOJ Solution-EMP University Employees-Solution in C, C++, Java, Python

Previous
SPOJ Solution - Test Life, the Universe, and Everything - Solution in C, C++, Java, Python