Heavy Coins   Bahosain has a lot of coins in his pocket. These coins are really heavy, so he always tries to get rid of some of the coins by using them when paying for the  taxi. Whenever Bahosain has to pay S pennies for the taxi driver, he tries to…
Runtime Error   Bahosain was trying to solve this simple problem, but he got a Runtime Error on one of the test cases, can you help him by solving it? Given an array of N non-negative integers and an integer K, your task is to find two integers X and…
Rock-Paper-Scissors   Rock-Paper-Scissors is a two-player game, where each player chooses one of Rock, Paper, or Scissors. Here are the three cases in which a player gets one  point: ­          Choosing Rock wins over a player choosing  scissors. ­  …
Travelling Salesman   After leaving Yemen, Bahosain now works as a salesman in Jordan. He spends most of his time travelling between different cities. He decided to buy a new car to help him in his job, but he has to decide about the capacity of the…
Epic Professor   Dr. Bahosain works as a professor of Computer Science at HU (Hadramout    University). After grading his programming exam, he noticed that most of the students have failed. Since this is the last semester for him teaching in Yemen, D…
Street Lamps   Bahosain is walking in a street of N blocks. Each block is either empty or has one lamp. If there is a lamp in a block, it will light it’s block and the direct adjacent blocks. For example, if there is a lamp at block 3, it will light…
题目链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1158 1158 全是1的最大子矩阵  基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题  收藏  关注 给出1个M*N的矩阵M1,里面的元素只有0或1,找出M1的一个子矩阵M2,M2中的元素只有1,并且M2的面积是最大的.输出M2的面积.   Input 第1行:2个数m,n中间用空格分隔(2 <= m,n <= 500)…
https://vjudge.net/problem/Gym-100712G 题意:给出n枚不同价值的硬币和一个总价S,现在要选择尽量多的硬币来大于等于S,要求是比如说现在选择的硬币的总和为sum,那么所选择的任何一个硬币x,sum-x都必须<S. 思路: 一开始是想排序然后优先选择小的...没想到最后是暴力枚举. 因为N很小,最大也就是10,每枚要么选,要么不选,二进制枚举. #include<iostream> #include<algorithm> #include&l…
UVA 1508 - Equipment 状态压缩 枚举子集 dfs ACM 题目地址:option=com_onlinejudge&Itemid=8&category=457&page=show_problem&problem=4254" target="_blank" style="color:rgb(0,136,204); text-decoration:none">UVA 1508 - Equipment--P…
UVA 11825 - Hackers' Crackdown 状态压缩 dp 枚举子集 ACM 题目地址:option=com_onlinejudge&Itemid=8&page=show_problem&problem=2925" style="color:rgb(0,136,204); text-decoration:none">11825 - Hackers' Crackdown 题意:  有一个由编号0~n-1的n台计算机组成的网络,一共…