山东理工大学第七届ACM校赛-学区房问题 分类: 比赛 2015-06-26 10:23 89人阅读 评论(0) 收藏

Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^
题目描述

铁牌狗在学区B有一套面积为S1平方米的房子,现在他为了让后代进化成金牌狗,决定在学区A购买一套面积为S2平方米的房子。已知学区B的房子每平方米的售价为T1,学区A的房子每平方米购价为T2,现在铁狗牌想知道卖掉学区B的房子后,还需要多少钱才能买下学区A的房子。
输入

多组输入。对于每组数据:

输入四个整数,S1,S2,T1,T2(0 < S1,S2,T1,T2 <= 1000),具体格式见样例。
输出

输出一个整数代表答案,具体格式见样例。

示例输入

1 10 1 10
1 1 10 10

示例输出

99
0

#include <stdio.h>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <cmath>
#include <queue>
#include <stack>
#include <algorithm>
#define INF 0x3f3f3f3f
#define Pi 3.141592654
using namespace std;

const int Max=101000;

int main()
{
    int s1,s2,t1,t2;
    while(~scanf("%d %d %d %d",&s1,&s2,&t1,&t2))
    {
        if(s1*t1>=s2*t2)
        {
            cout<<0<<endl;
        }
        else
        {
            cout<<s2*t2-s1*t1<<endl;
        }
    }
    return 0;
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

原文地址:https://www.cnblogs.com/juechen/p/4721992.html