zoukankan      html  css  js  c++  java
  • ural 2023 Donald is a postman(水)

    2023. Donald is a postman

    Time limit: 1.0 second
    Memory limit: 64 MB
    Problem illustration
    Donald Duck works as a postman for the Walt Disney Studios. He delivers children’s letters from all over the world to his friends, which are cartoon characters. The Studios has three cases for the letters, with nine sections in each case. Every section has the name of the receiver on it. All cases stand in a row as it is shown at the picture below.
    Donald Duck have brought n letters today. Initially, he stands near the leftmost case. He has to make one step to go to the neighboring case or to the previous one. How many steps will he make until he puts all the letters into the respective sections, if he does this in the order they are in his bag?
    Problem illustration

    Input

    The first line contains an integer n that is the amount of letters in Donald’s bag (1 ≤ n ≤ 1 000). The following n lines contain receivers of the letters in the order they are in the bag.

    Output

    Output the number of steps Donald should make to put all the letters into the cases.

    Sample

    inputoutput
    4
    Aurora
    Tiana
    Ariel
    Mulan
    
    5
    
    Problem Author: Alex Samsonov
    Problem Source: NEERC 2014, Eastern subregional contest
  • 相关阅读:
    zookeeper集群搭建
    mysql当前库的查询
    逻辑卷管理
    python小技巧,各种进制的转换
    修剪我的身心
    点击右键很慢,禁用网卡就好了问题解决了(转载)
    实际应用中的C#加密
    ckeditor+ckfinder配置
    ASP.NET MVC学习总结(二)
    MVC3关于用户名的验证
  • 原文地址:https://www.cnblogs.com/gongpixin/p/6790405.html
Copyright © 2011-2022 走看看