zoukankan      html  css  js  c++  java
  • ural 2014 Zhenya moves from parents

    2014. Zhenya moves from parents

    Time limit: 1.0 second
    Memory limit: 64 MB
    Zhenya moved from his parents’ home to study in other city. He didn’t take any cash with him, he only took his father’s credit card with zero balance on it. Zhenya succeeds in studies at the University and sometimes makes a little money on the side as a Maths tutor. As he makes his own money he spends only it, and when it is over he uses the credit card. Every time he gets or spends money, he sends a letter to his father, where he puts the following two things.
    1. The date when it took place
    2. The sum of earned or spent money
    Every time receiving a letter from Zhenya, his father calculates the debt on the credit card at the moment. But here a problem arises. The point is that Russian Post delivers letters in an order different to the one they were sent in.
    For example, in the first Zhenya’s letter the father read that on September 10 Zhenya spent one thousand rubles. He thought that his son had used the credit card, and now the debt is one thousand rubles. However the next day came a letter with the information that on September 9 Zhenya earned five hundred rubles. It means that half of the money he spent on September 10 was his own, and the debt on the credit card is just five hundred rubles.
    Help Zhenya’s father with his account management.

    Input

    The first line contains an integer n which is the number of Zhenya’s letters (1 ≤ n ≤ 100 000). These letters are listed in the next n lines. Description of each letter consists of the amount of money Zhenya spent or earned (in the form -c or +c accordingly, where c is an integer, 1 ≤ c ≤ 50 000) followed by both date and time when it took place (in the form of dd.MM hh:mm). All dates belong to the same year, which is not leap (i. e. there are 365 days in it). Any two letters contain either different dates or different time. The letters are listed in the order the father received them.

    Output

    After each received letter output what Zhenya’s father thinks the amount of the debt on the credit card is.

    Sample

    inputoutput
    5
    -1000 10.09 21:00
    +500 09.09 14:00
    +1000 02.09 00:00
    -1000 17.09 21:00
    +500 18.09 13:00
    
    -1000
    -500
    0
    -500
    -500
    
    Problem Author: Nick Burlakov (prepared by Olga Soboleva)
    Problem Source: NEERC 2014, Eastern subregional contest
  • 相关阅读:
    jquery异步加载json格式的数据
    三角形及选中取消按钮的css代码
    css实现自适应宽度布局
    table表格中实现tbody部分可滚动,且thead部分固定
    table数据表格添加checkbox进行数据进行两个表格左右移动。
    对checkbox 的checked的一些总结
    Java多线程同步器
    Springboot动态获取bean对象工具类
    并发阻塞队列和非阻塞队列详解
    多线程-volatile关键字和ThreadLocal详解
  • 原文地址:https://www.cnblogs.com/gongpixin/p/6790388.html
Copyright © 2011-2022 走看看