http://codeforces.com/contest/349
2021-06-29 00:06
标签:题解 i++ office number other tle end force clu The new "Die Hard" movie has just been released! There are n people at the cinema box office standing in a huge line. Each of them has a single 100, 50 or 25 ruble bill. A "Die Hard" ticket costs 25 rubles. Can the booking clerk sell a ticket to each person and give the change if he initially has no money and sells the tickets strictly in the order people follow in the line? The first line contains integer n (1?≤?n?≤?105) — the number of people in the line. The next line contains n integers, each of them equals25, 50 or 100 — the values of the bills the people have. The numbers are given in the order from the beginning of the line (at the box office) to the end of the line. Print "YES" (without the quotes) if the booking clerk can sell a ticket to each person and give the change. Otherwise print "NO". 简介:买电影票一张25一张,然后营业员最初没有钱,给你一个只有25 ,50,100的数列,问能否成功卖票,成功输出“yes”否则输出“NO” 题解:直接模拟,x代表25的票数y代表50的票数z代表100的票数 代码如下: 题目连接http://codeforces.com/contest/349/problem/A http://codeforces.com/contest/349 标签:题解 i++ office number other tle end force clu 原文地址:http://www.cnblogs.com/lhclqslove/p/7142383.html4
25 25 50 50YES
2
25 100NO
4
50 50 25 25NO
1 #include
文章标题:http://codeforces.com/contest/349
文章链接:http://soscw.com/index.php/essay/99127.html