poj3245(Customer support)

7 篇文章 0 订阅
6 篇文章 0 订阅
 
Customer support
Time Limit: 2000MS Memory Limit: 65536K
Total Submissions: 2644 Accepted: 1198

Description

Customer support department in an "Incomprehension Amateurs, Ltd" software company has call center for answering users' questions. Support prices are as follows:

1.Answer to a question10 USD
2.Correct answer to a question20 USD
3.Correct answer to a question with explanation40 USD
4.Correct answer to a question which was already correctly answered before+10 USD for each previous correct answerD

So, for example, if user asks the same question three times, first receives incorrect answer, then correct one, and the third time correct answer with explanation, it will cost him 10 + 20 + (40 + 1 * 10) = 80 USD.

Customers are billed monthly according to call log. Company engineers review the log and for each question determine:

1. unique number, so the equivalent questions have same numbers,
2. whether the answer was correct,
3. whether the answer was short or included detailed enough explanation.

Given that data, your program must calculate the payment amount.

Input

Input file contains number of calls N followed by N triples qi ai xi, where qi is integer question number, ai = 1 if the answer was correct, 0 otherwise, xi = 1 if explanation was given, 0 otherwise.

Constraints

1 ≤ N ≤ 10000, 1 ≤ qi ≤ 106.

Output

Output file must contain a single number — payment amount.

Sample Input

Sample Input 1
1
9834 0 1
Sample Input 2
3
33 1 0
33 0 0
33 1 1

Sample Output

Sample Output 1
10
Sample Output 2
80

Hint

Bold texts appearing in the sample sections are informative and do not form part of the actual data.
 
题目大意,输入问题编号,以及回答情况,让我们判断得到的钱的数目,这个题由于查询量是10000所以我用vector标记已经访问的编号,每次输入时判断是否已经被访问过、、、、、值得注意的是就算是回答错误了也会有10usd,代码如下:
#include<cstdio>
#include<cmath>
#include<vector>

#define PI 4*atan(1)
using namespace std;


int main(){
    int n;
    while(scanf("%d", &n) != EOF){
        int money = 0;
        vector<int> ve;
        for(int i = 0; i < n; i++){
            int a,b,c;
            scanf("%d%d%d",&a, &b, &c);
            int asked = 0;
            for(int j = 0; j < ve.size();j++){
                if(a == ve[j])  asked = 1;
            }
            if(asked == 1){
                if(b == 1){
                    money+=10;
                    if(c == 0)  money+=20;
                    else if(c == 1) money+=40;
                }
                else money+=10;
            }
            else{
                if(b == 1){
                    ve.push_back(a);
                    if(c == 0)   money+=20;
                    if(c == 1)  money+=40;
                }
                else if(b == 0)  money+=10;
            }
        }
        printf("%d\n", money);
    }
    return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值