[Bzoj2659] [uncomputation formula] [mathematics] And bzoj2659 mathematical formula

Source: Internet
Author: User

[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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.