2013年4月19日
摘要: Problem DescriptionMessage queue is the basic fundamental of windows system. For each process, the system maintains a message queue. If something happens to this process, such as mouse click, text change, the system will add a message to the queue. Meanwhile, the process will do a loop for getting m 阅读全文
posted @ 2013-04-19 21:32 耶稣爱你 阅读(189) 评论(0) 推荐(0)
摘要: DescriptionUgly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, ... shows the first 10 ugly numbers. By convention, 1 is included. Given the integer n,write a program to find and print the n'th ugly number. InputEach line of the input cont 阅读全文
posted @ 2013-04-19 20:23 耶稣爱你 阅读(196) 评论(0) 推荐(0)
摘要: 描述 一天TC的匡匡找ACM的小L玩三国杀,但是这会小L忙着哩,不想和匡匡玩但又怕匡匡生气,这时小L给匡匡出了个题目想难倒匡匡(小L很D吧),有一个数n(0<n<10),写出1到n的全排列,这时匡匡有点囧了,,,聪明的你能帮匡匡解围吗?输入第一行输入一个数N(0<N<10),表示有N组测试数据。后面的N行输入多组输入数据,每组输入数据都是一个整数x(0<x<10)输出按特定顺序输出所有组合。特定顺序:每一个组合中的值从小到大排列,组合之间按字典序排列。#include<iostream>#include<algorithm>using 阅读全文
posted @ 2013-04-19 19:33 耶稣爱你 阅读(175) 评论(0) 推荐(0)
  2013年4月18日
摘要: 描述在某一国度里流行着一种游戏。游戏规则为:在一堆球中,每个球上都有一个整数编号i(0<=i<=100000000),编号可重复,现在说一个随机整数k(0<=k<=100000100),判断编号为k的球是否在这堆球中(存在为"YES",否则为"NO"),先答出者为胜。现在有一个人想玩玩这个游戏,但他又很懒。他希望你能帮助他取得胜利。输入第一行有两个整数m,n(0<=n<=100000,0<=m<=1000000);m表示这堆球里有m个球,n表示这个游戏进行n次。 接下来输入m+n个整数,前m个分别表示这m个 阅读全文
posted @ 2013-04-18 22:25 耶稣爱你 阅读(162) 评论(0) 推荐(0)
  2013年4月17日
摘要: DescriptionFarmer 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 ≤ 20,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 the N 阅读全文
posted @ 2013-04-17 11:53 耶稣爱你 阅读(139) 评论(0) 推荐(0)
  2013年4月16日
摘要: Problem DescriptionJavac++ 一天在看计算机的书籍的时候,看到了一个有趣的东西!每一串字符都可以被编码成一些数字来储存信息,但是不同的编码方式得到的储存空间是不一样的!并且当储存空间大于一定的值的时候是不安全的!所以Javac++ 就想是否有一种方式是可以得到字符编码最小的空间值!显然这是可以的,因为书上有这一块内容--哈夫曼编码(Huffman Coding);一个字母的权值等于该字母在字符串中出现的频率。所以Javac++ 想让你帮忙,给你安全数值和一串字符串,并让你判断这个字符串是否是安全的?Input输入有多组case,首先是一个数字n表示有n组数据,然后每一组 阅读全文
posted @ 2013-04-16 22:44 耶稣爱你 阅读(268) 评论(0) 推荐(0)
摘要: 描述将正整数n表示成一系列正整数之和:n=n1+n2+…+nk, 其中n1≥n2≥…≥nk≥1,k≥1。 正整数n的这种表示称为正整数n的划分。求正整数n的不 同划分个数。输入第一行是测试数据的数目M(1<=M<=10)。以下每行均包含一个整数n(1<=n<=10)。输出输出每组测试数据有多少种分法。#include<iostream>using namespace std;int p(int n,int m){ if(n<1||m<1) return 0; if(n==1||m==1) return 1; if(n==m) return p(n 阅读全文
posted @ 2013-04-16 18:24 耶稣爱你 阅读(330) 评论(0) 推荐(0)