PAT basic level - Diamond Dan sample volume 2-7-1 psychological shadow area (5 points)

xlyy.JPG

This is a psychological shadow area chart. We all thought that he could move uniformly (blue straight line graph), and late Procrastination is the last moment of madness rush (red line chart) we tend to perform. Red, blue line around the area, is our psychological shadow area when homework.

Now given the red inflection point coordinates  (requires you to figure this psychological shadow area.

Input formats:

Input 2 is given a positive integer of not more than 100 in row  x and  y, and ensure  x > Y. It is assumed that the horizontal and vertical coordinates of the maximum value (i.e., completion deadline and final) are 100.

Output formats:

Output psychological shadow area in a row.

Friendly reminder: = area of ​​the triangle base length x height / 2; rectangular base area = length x height. Bao too complicated, which is a 5 minute test subtraction problem ......

Sample input:

90 10

Sample output:

4000



#include <iostream>

using namespace std;

int main()
{
    int x,y;
    cin>>x>>y;
    cout<<(100*100/2-100*(100-x)/2-100*y/2);
    system("pause");
    return 0;
}

 

Guess you like

Origin www.cnblogs.com/littlepage/p/11966790.html