Calculate the number of toys that land in each bin of a partitioned toy box. 计算每一个玩具箱里面玩具的数量 Mom and dad have a problem - their child John never puts his toys away when he is finished playing with them. They gave John a rectangular box to put his toy…
Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 15060   Accepted: 7270 Description Calculate the number of toys that land in each bin of a partitioned toy box. Mom and dad have a problem - their child John never puts his toys away when h…
We give the following inductive definition of a “regular brackets” sequence: the empty sequence is a regular brackets sequence, if s is a regular brackets sequence, then (s) and [s] are regular brackets sequences, and if a and b are regular brackets…
题目大意:给你一个矩形的左上角和右下角的坐标,然后这个矩形有 N 个隔板分割成 N+1 个区域,下面有 M 组坐标,求出来每个区域包含的坐标数.   分析:做的第一道计算几何题目....使用叉积判断方向,然后使用二分查询找到点所在的区域.   代码如下: ==========================================================================================================================…
1.poj 2239   Selecting Courses   二分图最大匹配问题 2.总结:看到一个题解,直接用三维数组做的,很巧妙,很暴力.. 题意:N种课,给出时间,每种课在星期几的第几节课上,求最多可上几种课. #include<iostream> #include<cstring> #include<cstdio> using namespace std; ][][]; ][],pipei[][]; int findn(int n) { ;i<=;i+…
题意:将一个无向图中的双向边改成单向边使图强连通,问最多能改多少条边,输出改造后的图. 分析: 1.双连通做法: 双连通图转强连通图的算法:对双连通图进行dfs,在搜索的过程中就能按照搜索的方向给所有边定向,其中桥不能改造,只能保留双向边. 代码: #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <cstdlib> #includ…
题意:就是你给一个n行m列的矩阵,矩阵里的元素由0和1组成,1代表肥沃的土地可以种植作物,0则不可以种植作物,并且相邻的土地不能同时种植作物,问你有多少种种植方案. 分析:这是我做的第一道状态压缩dp的题,总的来说还是很容易理解的,直接上代码! 代码实现: #include<stdio.h> #include<string.h> #include<math.h> #define mod 100000000 int n,m,a[15]; int dp[13][(1<…
Popular Cows Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 37111   Accepted: 15124 Description Every cow's dream is to become the most popular cow in the herd. In a herd of N (1 <= N <= 10,000) cows, you are given up to M (1 <= M &…
TOYS Time Limit: 2000MS Memory Limit: 65536K Description Calculate the number of toys that land in each bin of a partitioned toy box. Mom and dad have a problem - their child John never puts his toys away when he is finished playing with them. They g…
题目传送门:POJ 2318 TOYS Description Calculate the number of toys that land in each bin of a partitioned toy box. Mom and dad have a problem - their child John never puts his toys away when he is finished playing with them. They gave John a rectangular bo…