摘要:
题意:在N*N的图中,找出孤立存在的十字架的个数。十字架要求为正十字,孤立表示组成十字架的‘#的周围的一格再无’#‘。dfs找出在中心的‘#’(周围四格也为‘#'),则缩小了搜索范围,再bfs找出是否是符合要求。#include #include #include #include #include using namespace std;char map[55][55];int n,cnt,head,tail,vis[55][55],center[55][55];int dirx[4] = {1,-1,0,0};int diry[4] = {0,0,1,-1};struct Queu 阅读全文
摘要:
import java.beans.BeanInfo; import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Map;import org.apache.commons.beanutils.BeanUtils; import 阅读全文
摘要:
问题:求1~r中有多少个数与n互素。 对于这个问题由容斥原理,我们有3种写法,其实效率差不多。分别是:dfs,队列数组,位运算。 先说说位运算吧:用二进制1,0来表示第几个素因子是否被用到,如m=3,三个因子是2,3,5,则i=3时二进制是011,表示第2、3个因子被用到 LL Solve(LL n,LL r){ vector p; for(LL i=2; i*i1) p.push_back(n); LL ans=0; for(LL msk=1; msk1) p.push_back(n);}void dfs(LL k,LL t,LL s,LL... 阅读全文
摘要:
Problem Description The Princess has been abducted by the BEelzebub feng5166, our hero Ignatius has to rescue our pretty Princess. Now he gets into feng5166's castle. The castle is a large labyrinth. To make the problem simply, we assume the labyrinth is a N*M two-dimensional array which left-to 阅读全文
摘要:
OverflowWrite a program that reads an expression consisting of twonon-negative integer and an operator. Determine if either integer orthe result of the expression is too large to be represented as a``normal'' signed integer (typeinteger if you are workingPascal, type int if you are working i 阅读全文
摘要:
Problem Description Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M #include#includeusing namespace std;typedef struct nn{ int x,y; int time; friend bool operator Q; node q,p; q.time=0;q.x=sj;q.y=si; Q.push(q); while(!Q... 阅读全文
摘要:
点此连接到UVA10494思路: 采取一种, 边取余边取整的方法, 让这题变的简单许多~ AC代码:#include#includeint main() { long long mod; long long k, tmp; int len; int ans[10010]; char num[10010], ch[2]; while(scanf("%s%s%lld", num, ch, &mod) != EOF) { len = strlen(num); k = 0; tmp = 0; memset(ans, 0, sizeof(ans)); for(int i = 阅读全文
摘要:
题意:有n个人,n个房子,一个人每走一步(可上、下、左、右取一个方向)花费1美元,问让这n个人走到n个房子里最少需要多少美元(n >在学最小费用最大流,找模版题找到了这道。建图:1到n为人的编号,n+1到2*n为房子的编号,另加上源点0和汇点2*n+1;源点到每个人各建立一条容量为1的流,费用为0;每个人到每个房子各建立一条容量为1的流,费用按题意计算;(注意:反向费用!!!)每个房子到汇点建立一条容量为1的流,费用为0。当满足最大流时,一定是源点发出n,每个人接收1并发出1到一个房子,n个房子各发出1汇成n到汇点,所以,真是最小费用最大流的模版题。#include #include # 阅读全文
摘要:
LVM有扩容功能,无容错功能 物理卷: [root@localhost ~]# pvscan PV /dev/sda2 VG VolGroup lvm2 [19.51 GiB / 0 free] Total: 1 [19.51 GiB] / in use: 1 [19.51 GiB] / in no VG: 0 [0 ] [root@localhost ~]# pvcreate /dev/sd[bcd] 把bcd磁盘都设置为... 阅读全文
摘要:
Cheapest PalindromeTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 4592Accepted: 2236DescriptionKeeping track of all the cows can be a tricky task so Farmer John has installed a system to automate it. He has installed on each cow an electronic ID tag that the system will read as the cows pa 阅读全文
摘要:
在jni编译过程中,遇到non-numeric second argument to `wordlist' function错误,个人遇到这个错误的原因,是因为从windows中拷贝了Android.mk文件到ubuntu中,使用dos2unix Android.mk.把格式转化为unix格式即可。如还有错,尝试dos2unix AndroidManifest.xml。 阅读全文
摘要:
在用PHPWEB模板的时候,碰到首页有一个FLASH轮播广告,在IE浏览器下可以正常显示播放,在谷歌浏览器中却显示不了,解决办法如下: 欢迎转载:http://blog.csdn.net/aminfo/article/details/9721875 1、找到advs/templates/tpl_advsflashlb.htm这个文件; 2、将这个文件的原内容如下: 修改为新内容如下: 现在360浏览器客户端有好多也是用谷歌浏览器的内核,所以360浏览器不支持FLASH轮播广告的也可用以上方法解决。 阅读全文
摘要:
很多时候、我们需要选择出从指定位置开始的指定行数、此时、limit笑了 对于limit的定义是: limit x,y 表示从第x行开始选择y条记录 在业务需要分页操作的时候、我们通常采用limit+order by这对洗剪吹组合、高端洋气上档次 然而、当翻到非常靠后的页面时、MySQL需要花费大量的时间来扫描需要丢弃的数据 此时比较好的策略是使用延迟关联: 通过使用覆盖索引查询返回需要的主键、再根据这些主键关联原表获得需要的行 具体请看下面的一个例子 假如有这样一个查询:select film_id,actor,description from film w... 阅读全文
摘要:
WallTime Limit:1000MSMemory Limit:10000KTotal Submissions:26286Accepted:8760Description Once upon a time there was a greedy King who ordered his chief Architect to build a wall around the King's castle. The King was so greedy, that he would not listen to his Architect's proposals to build a 阅读全文
摘要:
题目大意就是给一个deque然后有n个数,依次进行操作,每种操作,你可以把这个数放在deque首部,也可以放在尾部,也可以扔掉不管,但是要保证deque中的数是非递减的。最要求deque中最长能是多少 思路是这样的:对于这个序列,最重要的应该是第一个进去的数是什么,然后以该数为开头的最长不升子序列和以该数为开头的最长不降子序列则可以凑成一个最长的序列,当然这两个序列中可能都出现了该数,也就是发生了重复,所以就要减掉重复的部分,即两个子序列中有该数个数较少的序列中这个数应当被减掉。然后由于数据量大,所以要用到二分求最长上升子序列的方法顺便使用了stl中的equal_range函数,意思就是返回一 阅读全文
摘要:
cocos的事件分发器CCTouchDispatcher,存在两个通道,m_pTargetedHandlers存储CMenu,CScrollView的事件处理器,这里的处理器,在处理过消息后,会声明bClaimed为True,表示事件有被处理过,如果处理器isSwallowsTouches为真,则处理过的消息将被吞噬掉,并且直接跳出对m_pTargetedHandlers的遍历,并且会把消息从消息列表中删除,后续的标准消息处理器将不会收到吞噬的消息。(menu默认会吞噬,CScrollView默认不会) m_pStandardHandlers存储layer的事件处理器,并且,没有吞噬消息的逻辑 阅读全文
摘要:
这题太欢乐了......虽然wa了几次,但是想到骑士在两幅图的传送门中传来传去就觉得这骑士太坑了#include #include #include #include using namespace std;int n,m,cost,head,tail,ans;char map[2][15][15];int sum[2][15][15];struct node { int z,x,y;} q[11111];node st, end;int dirx[4] = {1,-1,0,0};int diry[4] = {0,0,1,-1};void init() { memset(sum,-... 阅读全文
摘要:
Problem A: Football (aka Soccer) The Problem Football the most popular sport in the world (americans insist to call it "Soccer", but we will call it "Football"). As everyone knows, Brasil is the country that have most World Cup titles (four of them: 1958, 1962, 1970 and 1994). As 阅读全文
摘要:
Problem Description The TV shows such as You Are the One has been very popular. In order to meet the need of boys who are still single, TJUT hold the show itself. The show is hold in the Small hall, so it attract a lot of boys and girls. Now there are n boys enrolling in. At the beginning, the n boy 阅读全文
摘要:
The die is castInterGames is a high-tech startup company that specializes in developing technology that allows users to play games over the Internet. A market analysis has alerted them to the fact that games of chance are pretty popular among their potential customers. Be it Monopoly, ludo or backga 阅读全文