摘要: 从 n 个整数中任选 k 个整数相加,可分别得到一系列的和 要求你计算出和为素数共有多少种IN4 33 7 12 19OUT1 1 # include 2 # include 3 # include 4 using namespace std ; 5 6 int a[22] ; 7 int ... 阅读全文
posted @ 2015-05-15 20:22 __Meng 阅读(270) 评论(0) 推荐(0) 编辑
摘要: n*n的棋盘摆K的棋子,任意两个棋子不能在同一行同一列Sample Input2 1#. //# 可放.#4 4...#..#..#..#...-1 -1Sample Output21 1 # include 2 # include 3 # include 4 using namespace ... 阅读全文
posted @ 2015-05-15 20:21 __Meng 阅读(184) 评论(0) 推荐(0) 编辑
摘要: hdu 1241 油田 裸DFS题意:@代表油田 8个方向上还有@就相连 相当于求图中连通子图的个数Sample Input1 1 // n m*3 5*@*@***@***@*@*1 8@@****@*5 5 ****@*@@*@*@**@@@@*@@@**@0 0 Sample Output... 阅读全文
posted @ 2015-05-15 20:20 __Meng 阅读(430) 评论(0) 推荐(0) 编辑
摘要: 求一个字符串所有的相同前后缀Sample InputababcababababcababaaaaaSample Output2 4 9 181 2 3 4 5 1 #include 2 #include 3 #include 4 #include 5 using namespace std;... 阅读全文
posted @ 2015-05-13 23:51 __Meng 阅读(642) 评论(0) 推荐(0) 编辑
摘要: 题意:输入n个数 n为奇数 问某个数出现的次数大于等于(N+1)/2的是 哪个 输出来Sample Input51 3 2 3 3111 1 1 1 1 5 5 5 5 5 571 1 1 1 1 1 1 Sample Output351 1 #include 2 #include 3 u... 阅读全文
posted @ 2015-05-13 23:00 __Meng 阅读(206) 评论(0) 推荐(0) 编辑
摘要: Sample Input6 4 //输出第4个全排列11 8 Sample Output1 2 3 5 6 41 2 3 4 5 6 7 9 8 11 10 1 # include 2 # include 3 # include 4 using namespace std ; 5 6 i... 阅读全文
posted @ 2015-05-12 17:16 __Meng 阅读(204) 评论(0) 推荐(0) 编辑
摘要: Sample Input3aAbabcacbaSample OutputAabAbaaAbabAbAabaAabcacbbacbcacabcbaaabcaacbabacabcaacabacbabaacbacabcaacaabcabacbaa对字符串进行全排列,字符的大小规则: 'A' 2 # i... 阅读全文
posted @ 2015-05-12 17:15 __Meng 阅读(255) 评论(0) 推荐(0) 编辑
摘要: Sample Inputdog ogdaycat atcaypig igpayfroot ootfrayloops oopslayatcayittenkayoopslaySample Outputcatehloops大致题意:输入一个字典,字典格式为“英语à外语”的一一映射关系然后输入若干个外语单词... 阅读全文
posted @ 2015-05-12 17:13 __Meng 阅读(283) 评论(0) 推荐(0) 编辑
摘要: Sample InputSTARTfrom fiwohello difhmars riwosfearth fnnvklike fiiwjENDSTARTdifh, i'm fiwo riwosf.i fiiwj fnnvk!END Sample Outputhello, i'm from mars.... 阅读全文
posted @ 2015-05-12 17:11 __Meng 阅读(268) 评论(0) 推荐(0) 编辑
摘要: Sample Input5 //Tgreenredblueredred 统计颜色的次数 输出最多的颜色3pinkorangepink0 Sample Outputred pink 1 # include 2 # include 3 # include 4 # include 5 ... 阅读全文
posted @ 2015-05-12 17:08 __Meng 阅读(205) 评论(0) 推荐(0) 编辑