随笔分类 - 贪心
摘要:The Power Cube is used as a stash of Exotic Power. There are n cities numbered 1,2,…,n where allowed to trade it. The trading price of the Power Cube
阅读全文
摘要:B . Problem DescriptionChiaki has n strings s1,s2,…,sn consisting of '(' and ')'. A string of this type is said to be balanced:+ if it is the empty st
阅读全文
摘要:A tree with N nodes and N-1 edges is given. To connect or disconnect one edge, we need 1 unit of cost respectively. The nodes are labeled from 1 to N.
阅读全文
摘要:题意:01给出一个数n,现在要将它分为m个数,这m个数相加起来必须等于n,并且要使得这m个数的或值最小。 思路分析: 一个简单的贪心,从高位到低位,判断当前位可否为 1 ,若可以,则将所有的数的这一位全部都变成 1 代码示例:
阅读全文
摘要:链接:https://www.nowcoder.com/acm/contest/80/D来源:牛客网 最可爱的applese生日啦,他准备了许多个质量不同的蛋糕,想请一些同学来参加他的派对为他庆生,为了不让一部分同学感到不爽,他决定把每个蛋糕都分割成几份(也可以不分割),使得最小的蛋糕的质量与最大的
阅读全文
摘要:链接:https://www.nowcoder.com/acm/contest/82/A来源:牛客网 题目描述 t次询问,每次给你一个数n,求在[1,n]内约数个数最多的数的约数个数 输入描述: 第一行一个正整数t之后t行,每行一个正整数n 输出描述: 输出t行,每行一个整数,表示答案 示例1 输入
阅读全文
摘要:A New Year party is not a New Year party without lemonade! As usual, you are expecting a lot of guests, and buying lemonade has already become a pleas
阅读全文
摘要:Last year Bob earned by selling memory sticks. During each of n days of his work one of the two following events took place: A customer came to Bob an
阅读全文
摘要:“今年暑假不AC?” “是的。” “那你干什么呢?” “看世界杯呀,笨蛋!” “@#$%^&*%...” 确实如此,世界杯来了,球迷的节日也来了,估计很多ACMer也会抛开电脑,奔向电视了。 作为球迷,一定想看尽量多的完整的比赛,当然,作为新时代的好青年,你一定还会看一些其它的节目,比如新闻联播(永
阅读全文
摘要:cls与lzp的热身赛 发布时间: 2017年12月11日 13:58 最后更新: 2017年12月11日 14:46 时间限制: 1000ms 内存限制: 128M 描述 众所周知,长春理工大学的“嗨呀好气啊”队伍由两个菜鸡lzp和cls以及某X姓巨巨组成,热身赛打的太好可能导致电脑里的PC^2被
阅读全文