`
zsybupt
  • 浏览: 41477 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论
文章列表

boj 672

    博客分类:
  • oj
Description As the title suggest, this problem is yet another boring stone game. There are N piles of stones, Alice and Bob take turns to take away stones from the game, Alice plays first. Each time one can choose a pile and take n stones away from it, where n=x^y, x is a given number and y is a ...

boj 302

    博客分类:
  • oj
题目是图片形式给出的,只能贴出地址: http://acm.bupt.edu.cn/onlinejudge/newoj/showProblem/show_problem.php?problem_id=302 思路: 对于区间[Li,Ri),按照Li排序,然后对于每个方块区间[Li,Ri),判断当前所有层中最右边的方块的Rk是否小于等于Li,如果存在,则将[Li,Ri)放入该层,如果不存在,则新加一层。更新此层最右边方块为Ri。 开始的时候用数组Floor记录,每次扫描没一层,结果超时。 超时代码: #include<iostream> #include<alg ...

boj 321

    博客分类:
  • oj
Description   There is a positive integer N, and please give us the smallest root x of equation sqrt(N)=sqrt(x)-sqrt(y) when x and y are both positive integer. Input   There are several test cases and end by EOF.   Each line contain a positive integer N, 1<N≤2^31-1. Output   There is only one ...

boj 7

    博客分类:
  • oj
Description Farmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N  (1 ≤ N ≤ 1,000)) planks of wood, each having some integer length Li (1 ≤ Li ≤ 50,000) units. He then purchases a single long board just long enough to saw into t ...

boj 462

    博客分类:
  • oj
DescriptionJyc最近在学《现代交换原理》这门传说中的北京市精品课程。本来以为很简单,但晚上在做作业时就被一道题搞的很郁闷。交换单元是交换网络最基本的部件,其有M根入线和N根出线,它的功能就是将这M根入线上的数据按一定的规则交换到N根出线上。这个单元内部连线的不同就造成出线数据的不同,因此会有许多组合。比如说下面就是最简单的两种组合。 当然这种连接有一定的规则。一根入线可以连到多根出线上,以实现广播的功能。但一根出线不能同时和多根入线相连,这样就会造成冲突。题目现在要对一个有M根入线和N根出线的系统进行处理,其要求M根入线和N根出线上都有合法数据在传输(输入输出线都不能出现悬 ...

boj 196

    博客分类:
  • oj
Description CC lives on the  tree which has N nodes.On every leaf of the tree there is an apple(leaf means there is only one branch connect this node ) .Now CC wants to get two apple ,CC can choose any node to start and the speed of CC is one meter per second. now she wants to know the shortest ti ...

boj 36

    博客分类:
  • oj
Fax machines use a form of compression based on run-length encoding. Run-length encoding (RLE)is a very simple form of data compression in which runs of data (that is, sequences in which the same data value occurs in many consecutive data elements) are stored as a single data value and count, rather ...

boj 376

    博客分类:
  • oj
Descriptioncloudiris是个爱学习的好孩子,每天她都会记单词,可她一翻开单词书看到如此之多的单词就感到头疼,于是她想出了一个和别人不相同的记单词的方法。她把单词归类分成几组,每一组单词的开头几个字母都是相同的, ...

boj 377

    博客分类:
  • oj
Description相信大家都玩过成语接龙吧,现在我们来玩一个单词接龙的游戏。游戏是在一个单词表上进行的,我们定义单词B可以接在单词A后,当且仅当A是B的前缀且B不等于A。考察如下的单词表:i、in、ix、int,一共有i->in、i->ix、i->int、in->int共4种接法。现在给定一个单词表,求出这个单词表可以构成的最长单词串包含的单词个数。Input输入包含多组测试数据。首先第一行输入一个数T(T<=50),表示总共有T组测试数据。接下来是每组测试数据,第一行是一个数N(1<=N<=200),表示该单词表有N个单词。然后接下来的N行,每 ...

boj 288

    博客分类:
  • oj
Description As is told by the olds, there is a wonderful land of girls and magic, which has a fantasy name —— Gensokyo. Today's Gensokyo is still peaceful. And a silly ice fairy Cirno wants to play games with her girfriend Daiyousei. She uses her ice magic to make some ice cubes with numbers on i ...

boj 1071

    博客分类:
  • oj
Descriptiondalong他们马上要去final了,他们这次将要坐灰机到瑞典,灰机会经过N个城市(包括起点和终点),由于这次出国机会难得,他们决定的要访问尽可能多的城市。注意这是一张往返机票,并且每个城市最多只能访问一次,除了起始点可以访问两次。现在给出N个城市,编号从1到N,并且城市从东往西排列。去时飞机只能从东往西飞不能反过来,回来时,只能从西往东不能反过来。注意必须到达最西面才能开始返回!现在会给出M条航班,航班都是双向的。由于dalong们最近非常忙,要wangkun帮他们计划如何安排使飞机可以往返并且访问尽可能的城市。wangkun最近有点脑残,聪明的你,能不能帮一下wan ...

boj 65

    博客分类:
  • oj
Description     champ最近在和dalong玩一个取石子游戏,游戏规则很简单:有三堆石子,两人轮流取,每次任选两堆石子,然后从一堆中取走x(x>=1)个石子,另一堆中取走2*x个石子,最后不能取者输掉游戏,champ每一次都先取。    现在,champ告诉你初始三堆石子的数量,他想知道,自己是否有必胜的策略。你可以假定champ和dalong都足够聪明,每次都会选择最优的策略。

boj 439

    博客分类:
  • oj
水题,用到STL map,还是得细心点,不要少写了逻辑上应该的操作。 代码: #include<iostream> #include<map> using namespace std; map<int,int>ElementStore; int main() { int n,m; scanf("%d",&n); while(n--) { int maxlen=-1; int curpos=0; int tmplen=0; ElementStore.clear(); ...

boj 19

    博客分类:
  • oj
  Description   在一张卡片上面,有N+1个正整数,最后一个数是M,而前N个数都不超过M,设为a1, a2, a3, …, aN, 问是否存在整数x1, x2, x3, …, xN, x(N+1), 满足x1*a1 + x2*a2 +...+ xN*aN +x(N+1)*M = 1。

boj 462

    博客分类:
  • oj
dp  {i,j}=i*{i,j-1}+i*{i-1,j-1}=i*[{i,j-1}+{i-1,j-1}]; #include<iostream> using namespace std; long long dp[1005][1005];//dp[i][j]表示i条入线,j条出线 int main() { for(int i=0;i<=1000;i++) dp[0][i]=dp[i][0]=0; dp[1][1]=1; for(int i=1;i<=1000;i++) { for(int j=1;j<=1000; ...
Global site tag (gtag.js) - Google Analytics