[Bzoj2659] [uncomputation formula] [mathematics] And bzoj2659 mathematical formula
Description
Uncomputation Formula
Background:
I once had an old game in front of me, and I did not cherish it. It was not until this game was stopped that it had no regrets. This is the most painful thing in the world. If God gives me another chance to play, I must pass the Customs!
Description:
If you really want to play this game, let's take a look at my questions first. If you don't know this, you won't be able to perform customs clearance. The first step is actually very simple. There is only one door closed with a password lock. There is a strange formula written on this door. It is estimated that you should use it to calculate the password to open the door (it is really an old story ).
In legend, p and q in this formula are two odd numbers. The right side of the equal sign should be the password. Are you sure you cannot calculate it?
Input
There is only one row, and there are two odd numbers, p and q respectively.
Output
A number indicates the formula result.
Sample Input5 7
Sample Output6
HINT
HINT: p and q are within the 32-bit integer range.
Question: If p = q, just push it.
If p! = Q we found that this thing is very similar to the slope, so we want to find the number of points under this line.
And that's fine ..
Code:
#include<iostream>#include<cstdio>using namespace std;int p,q;int main(){ cin>>p>>q; if (p==q) cout<<(long long)(p+1)*(q-1)/4; else cout<<(long long)(p-1)*(q-1)/4;}
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.