zoukankan      html  css  js  c++  java
  • poj水题ID3030

    Problem:

    Input

    The input consists of n cases, and the first line consists of one positive integer giving n. The next n lines each contain 3 integers, re and c. The first, r, is the expected revenue if you do not advertise, the second, e, is the expected revenue if you do advertise, and the third, c, is the cost of advertising. You can assume that the input will follow these restrictions: −106 ≤ re ≤ 106 and 0 ≤ c ≤ 106.

    Output

    Output one line for each test case: “advertise”, “do not advertise” or “does not matter”, presenting whether it is most profitable to advertise or not, or whether it does not make any difference.

    Sample Input

    3
    0 100 70
    100 130 30
    -100 -70 40

    Sample Output

    advertise
    does not matter
    do not advertise

    我的submission:(又是一次性通过哦,很水的题啦,连我这样的菜鸟都可以通过,O(∩_∩)O哈哈~)
    #include <iostream>
    using namespace std;
    int main()
    {
         int i,r,e,c;
         cin>>i;
         while(i>0)
         {
             cin>>r>>e>>c;
                  if(e-c>r) cout<<"advertise"<<endl;
                  else if (e-c==r)cout<<"does not matter"<<endl;
                  else cout<<"do not advertise"<<endl;
                  i--;                              
             
                   }
         return 0;
     }
    

      PS:input中描述的蓝色加粗部分,其实是输入值的限定条件,起初整错了陷入死循环了;其实ACM这个平台对题目的验证,貌似对这样的限定条件并无要求,也就是说不会用非法值去验证你的程序是否通过。这也是做ACM的一个小经验吧,嘿嘿

  • 相关阅读:
    网易编程题——小易喜欢的单词
    Effective C++ 条款12:复制对象时勿忘其每一个成分
    Effective C++ 条款11:在operator=中处理"自我赋值"
    STM32-通用定时器基本定时功能
    GPIO_Mode
    STM32的ADC编程方法
    STM32的ADC采样与多通道ADC采样
    网络子系统
    linux网络子系统内核分析
    Linux 中高效编写 Bash 脚本的 10 个技巧
  • 原文地址:https://www.cnblogs.com/lx09110718/p/poj3030.html
Copyright © 2011-2022 走看看