02 2014 档案

摘要:数学题 求2^p-1的位数代码: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 int main() 8 { 9 int p;10 while(cin>>p)11 {12 cout<<int(p*log10 (2.0))+1<<endl;13 }14 return 0;15 }View Code 阅读全文
posted @ 2014-02-27 21:02 悠悠我心。 阅读(129) 评论(0) 推荐(0)
摘要:new int;//开辟一个存放整数的存储空间,返回一个指向该存储空间的地址(即指针) new int(100);//开辟一个存放整数的空间,并指定该整数的初值为100,返回一个指向该存储空间的地址 new char[10];//开辟一个存放字符数组(包括10个元素)的空间,返回首元素的地址 new int[5][4];//开辟一个存放二维整型数组(大小为5*4)的空间,返回首元素的地址 float *p=new float (3.14159);//开辟一个存放单精度数的空间,并指定该实数的初值为//3.14159,将返回的该空间的地址赋给指针变量p new运算符使用的一般... 阅读全文
posted @ 2014-02-27 04:13 悠悠我心。 阅读(741) 评论(0) 推荐(0)
摘要:联系网络Time Limit: 1000 MSMemory Limit: 32768 KTotal Submit: 6(5 users)Total Accepted: 5(5 users)Rating:Special Judge:NoDescriptionTwIStOy要建立一个联系网络,这样可以方... 阅读全文
posted @ 2014-02-26 14:50 悠悠我心。 阅读(200) 评论(0) 推荐(0)
摘要:CheerleadersIn most professional sporting events, cheerleaders play a major role in entertaining the spectators. Their roles are substantial during breaks and prior to start of play. The world cup soccer is no exception. Usually the cheerleaders form a group and perform at the centre of the field. I 阅读全文
posted @ 2014-02-24 14:50 悠悠我心。 阅读(343) 评论(0) 推荐(0)
摘要:在别人博客找的 帮上大忙了《算法竞赛入门经典——训练指南》第二章相关内容分类:资料2013-01-04 20:541293人阅读评论(4)收藏举报#《算法竞赛入门经典——训练指南》第二章相关内容由于动态规划的高阶比较难,所以伴随这数论一起刷红色为做了黄色不懂的 希望各位大牛能帮帮小弟勘误P112.例题4,LA3516的图画错了,请参考原题:https://icpcarchive.ecs.baylor.edu/external/35/3516.html[第二次印刷改正]p180.表2-8 第一行信息有误,应为:例题14UVa11021Tribbles离散概率;递推以下是《算法竞赛入门经典——训. 阅读全文
posted @ 2014-02-24 13:56 悠悠我心。 阅读(448) 评论(0) 推荐(0)
摘要:|A∪B∪C∪D|=|A|+|B|+|C|+|D|-|A∩B|-|A∩C|-|A∩D|-|B∩C|-|B∩D|-|C∩D|+|A∩B∩C |+|A∩B∩D|+|B∩C ∩D|-|A∩B∩C ∩D| 阅读全文
posted @ 2014-02-24 13:40 悠悠我心。 阅读(103) 评论(0) 推荐(0)
摘要:You are givennrods of length 1, 2…, n. You have to pick any 3 of them & build a triangle. How many distinct triangles can you make? Note that, two triangles will be considered different if they have at least 1 pair of arms with different length.InputThe input for each case will have only a singl 阅读全文
posted @ 2014-02-23 23:53 悠悠我心。 阅读(246) 评论(0) 推荐(0)
摘要:Problem AChess QueenInput:Standard InputOutput:Standard OutputYou probably know how the game of chess is played and how chess queen operates. Two chess queens are in attacking position when they are on same row, column or diagonal of a chess board. Suppose two such chess queens (one black and the ot 阅读全文
posted @ 2014-02-23 16:04 悠悠我心。 阅读(283) 评论(0) 推荐(0)
摘要:Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem.The shores of Rellau Creek in central Loowater had always been a prime breeding ground for geese. Due to the lack of predators, the geese population was out of control. The people of Loowater mostly kept clear 阅读全文
posted @ 2014-02-23 08:43 悠悠我心。 阅读(243) 评论(0) 推荐(0)
摘要:A. NineteenAlice likes word "nineteen" very much. She has a stringsand wants the string to contain as many such words as possible. For that reason she can rearrange the letters of the string.For example, if she has string "xiineteenppnnnewtnee", she can get string "xnineteen 阅读全文
posted @ 2014-02-18 23:37 悠悠我心。 阅读(382) 评论(0) 推荐(0)
摘要:zxp学长告诉我两种计算pi值得办法,第一种是pi/4=1-1/3+1/5-1/7……(课本上的传统方法)第二种方法是这种方法的证明(以上由zxp学长找的资料给我的……)用C++写出这两种方法求解pi的过程,然后比较这两种方法收敛的速度 1 #include 2 #include 3 #include 4 using namespace std; 5 int main(){ 6 double pi1=0; 7 double pi2; 8 for(double i=0;i<1500000;i++){//the method in text book should use ... 阅读全文
posted @ 2014-02-17 21:42 悠悠我心。 阅读(4739) 评论(1) 推荐(0)
摘要:Manao is designing the genetic code for a new type of algae to efficiently produce fuel. Specifically, Manao is focusing on a stretch of DNA that encodes one protein. The stretch of DNA is represented by a string containing only the characters 'A', 'T', 'G' and 'C'.Ma 阅读全文
posted @ 2014-02-17 20:26 悠悠我心。 阅读(264) 评论(0) 推荐(0)
摘要:B.WordFoldingYouwillreceive5pointsforsolvingthisproblem.Manaohasinventedanewoperationonstringsthatiscalledfolding.Eachfoldhappensbetweenapairofconsecutivelettersandplacesthesecondpartofthestringabovefirstpart,runningintheoppositedirectionandalignedtothepositionofthefold.Usingthisoperation,Manaoconve 阅读全文
posted @ 2014-02-17 12:51 悠悠我心。 阅读(334) 评论(0) 推荐(0)
摘要:390 A. Inna and Alarm Clockhttp://codeforces.com/contest/390/problem/A水题一枚,两个set就可完成 1 #include 2 #include 3 #include 4 using namespace std; 5 6 sets1,s2; 7 8 int main() 9 {10 int n,a,b;11 while(cin>>n)12 {13 s1.clear();14 s2.clear();15 while(n--)16 {17 ... 阅读全文
posted @ 2014-02-16 09:34 悠悠我心。 阅读(265) 评论(0) 推荐(0)
摘要:题意:n种硬币围城一个圈,每人可取一个或连续两个,取出后就留下空格,取走最后一个硬币的人赢。分析:1、n==1||n==2 明显先手赢2、n==3 明显 后手赢3、 n>=4 若n为偶数则无论先手取一个或者是两个 后手肯定会在相对的位置取相同的数目 所以先手必败 若n位奇数 若先手取一个则后手可在相对的位置取两个使其变成偶数 若先手去两个同理所以 先手必败 阅读全文
posted @ 2014-02-14 23:20 悠悠我心。 阅读(320) 评论(0) 推荐(0)
摘要:一、动态规划:如果一句话总结的的话,我觉得dp是这样的:动态规划是用空间换时间的一种方法的抽象,其关键是发现子问题和记录其结果,然后利用这些结果减轻运算量。二、01背包思路:主要的有两点:1 f[i][v]=max{f[i-1][v],f[i-1][v-c[i]]+w[i]}2三、代码:以HDU2602为例1 二维递推版 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int maxn=1005; 7 8 int dp[maxn][maxn]; 9 10 int va[maxn],vo[maxn];11 1.. 阅读全文
posted @ 2014-02-05 18:27 悠悠我心。 阅读(735) 评论(0) 推荐(0)