Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # include <bits/stdc++.h>
- using namespace std;
- # define ll long long
- int main()
- {
- ll n,k,i,j,s = 0,x,y;
- cin >> n;
- for(i = 0; i < n; i++){
- cin >> x >> y;
- if(x == y){
- cout << x * x - x + 1 << endl;
- }
- if(x > y && !(x % 2)){
- cout << x * x - y + 1 << endl;
- }
- if (y > x && y % 2){
- cout << y * y - x + 1 << endl;
- }
- if(x > y && x % 2){
- cout << (x - 1) * (x - 1) + y << endl;
- }
- if(y > x && !(y % 2)){
- cout << (y - 1) * (y - 1) + x << endl;
- }
- }
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement