Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define ll long long
- #include <bits/stdc++.h>
- using namespace std;
- const int OO = 1e9;
- const double EPS = 1e-9;
- int main()
- {
- ios_base::sync_with_stdio(NULL);
- cin.tie(0);
- cout.tie(0);
- //freopen("out.txt","w",stdout);
- string in;
- while(getline(cin,in)) {
- bool mult = false;
- //stringstream ss(in);
- for(int i = 0; i < in.length(); i++) {
- if(in[i] == ' ') {
- ll a = stoi(in.substr(0,i));
- ll b = stoi(in.substr(i+1));
- ll ans = 0;
- for(ll i = a; i <= b; i++) {
- //ans += ((i%2 == 1) ||(i%4 == 0));
- if((i%2 == 1) || (i%4 == 0)) {
- ans++;
- }
- }
- ans = b-a+1 - ans;
- cout << ans << "\n";
- mult = true;
- //cout << "a is " << a << " b is " << b << "\n";
- //cout << "diff is " << b-a+1 << "\n";
- }
- }
- if(mult) {
- continue;
- }
- ll n = stoi(in);
- bool neg = false;
- if(n == 0) {
- cout << "0 0\n";
- continue;
- }
- if(n < 0) {
- neg = true;
- n = abs(n);
- }
- if(n%2 == 1) {
- ll a = (1+n)/2;
- ll b = n-a;
- if(neg) {
- swap(a,b);
- }
- cout << a << " " << b << "\n";
- }
- else if(n%4 == 0) {
- ll a = (2 + (n/2))/2;
- ll b = (n/2)-a;
- if(neg) {
- swap(a,b);
- }
- cout << a << " " << b << "\n";
- }
- else {
- cout << "Bachelor Number.\n";
- }
- //cout << "n is " << n << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement