题意:给n个学生安排住宿,条件是每个学生所分配的面积至少为6平米,给你学生数n及现有的房子面积a*b。可以从任何边扩展,问扩展后的满足条件的最小面积及边长。
思路:按边暴力
代码:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define...
分类:
其他好文 时间:
2015-05-04 22:18:35
阅读次数:
148
#include
#include
using namespace std;
class Sd
{
public:
string name;
static string teacher;
static int room;
Sd(const string & n):name(n){}
void show(){cout<<"我是"<<name<<"在"<<room<<"听"<<teacher...
分类:
编程语言 时间:
2015-05-04 22:17:52
阅读次数:
138
Description
The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices.
— It i...
分类:
其他好文 时间:
2015-05-04 18:17:41
阅读次数:
94
学完设计模式就需要开始练习练习,我会慢慢把所有的设计模式都练习一遍的。整个练习的背景就是设计模式书上的迷宫。不过书上只是零零散散地把创建型的迷宫实现了,而且还没有联系。下面先上一张图,当然,还不完全。
看着这张图,可以慢慢地来分析了。首先从房间入手吧。Room这里用的是原型模式(其实用建筑模式会更好),然后Room里面需要有两样东西:
1>有一个守卫。(这是一个人的类,之后再介绍)...
分类:
其他好文 时间:
2015-05-03 13:23:51
阅读次数:
97
分析:该題可以用贪心来做,类似于节目时间安排的问题,桌子的移动房间看作时间处理。
下面是另一种更简便的做法。把奇数房间号和偶数房间号映射为房间在走廊上的位置,从1到200;开一个数组,每次从s移桌子到t就把中间走廊的每个位置都加1,最后扫描整个数组,找出最大值在乘上移动一张桌子所用的时间就是必须花费的时间。
#include
using namespace std;
int room...
分类:
其他好文 时间:
2015-04-29 21:43:45
阅读次数:
129
解题报告 之 POJ3057 Evacuation 最大流 动态流 更新残余网络 多次增广
Fires can be disastrous, especially when a fire breaks out in a room that is completely filled with people. Rooms usually have a couple of exits and emergency exits, but with everyone rushing out at the same t...
分类:
其他好文 时间:
2015-04-28 23:04:05
阅读次数:
340
I. 创建表结构和测试数据create table rooms(id int not null auto_increment, name varchar(100), primary key(id));insert into rooms values(1,'Royal Room');insert in...
分类:
数据库 时间:
2015-04-27 13:03:58
阅读次数:
173
解题报告 之 SOJ2414 Leapin' Lizards
Your platoon of wandering lizards has entered a strange room in the labyrinth you are exploring. As you are looking around for hidden treasures, one of the rookies steps on an innocent-looking stone and the room's floor sudd...
ACboy was kidnapped!! he miss his mother very much and is very scare now.You can't image how dark the room he was put into is, so poor :(.As a smart A...
分类:
其他好文 时间:
2015-04-23 23:16:22
阅读次数:
168
Suppose you have a tblRoom and tblUserInfo. Now, you need to select all the rooms regardless of whether the room has user information or not. This cal...
分类:
其他好文 时间:
2015-04-22 17:34:47
阅读次数:
209