• 会场安排问题

    假设要在足够多的会场里安排一批活动,并希望使用尽可能少的会场。设计一个有效的贪心算法进行安排。(这个问题实际上是著名的图着色问题。若将每一个活动作为图的一个顶点,不相容活动间用边相连。使相邻顶点着有不同颜色的最小着色数,相应于要找的最小会场数。) 编程任务: 对于给定的k个待安排的活动,编程计算使用最少会场的时间表。 数据输入: 第一行有1 个正整数k,表示有k个待安排的活动。接下来的k行中,每行有2个正整数,分别表示k个待安排的活动开始时间和结束时间。时间以0 点开始的分钟计。 结果输出: 输出编程计算出的最少会场数。

    0
    28
    1KB
    2013-04-23
    9
  • 组合数学,取子游戏,nim简单

    组合数学编程题取子游戏(简单)Two players alternate in removing either one or two from the pile. The player who remove the last stick is the loser. The opponent remove sticks at the first, then it's your turn. Write a program to determine how many sticks should be removed when there's n sticks left in the pile.

    5
    279
    14KB
    2013-03-31
    16
  • 组合数学取子游戏nim

    Nim is a 2-player game featuring several piles of stones. Players alternate turns, and on his/her turn, a player’s move consists of removing one or more stones from any single pile. Play ends when all the stones have been removed, at which point the last player to have moved is declared the winner. Given a position in Nim, your task is to determine how many winning moves there are in that position. 组合数学取子游戏代码实现。

    4
    296
    19KB
    2013-03-31
    15
关注 私信
上传资源赚积分or赚钱