摘要:
题目地址http://acm.pku.edu.cn/JudgeOnline/problem?id=3277首先离散化,然后使用线段树。提示:题目中说N<=40000,然后RE了几次,看讨论里面说开到70000才可以。代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighligh... 阅读全文
摘要:
思路来自DISCUSS,嵌套的BFS,外重BFS是箱子的,内重BFS是人的(即判断人否能到达外重BFS求出来的能把箱子推到该位置的位置)然后就是路径的记录,我开了一个大字符串数组来记录人走的路径(可以通过内重BFS记录),外重BFS则记录推箱子的路径,反正有点繁琐,要比较细心。代码Code highlighting produced by Actipro CodeHighlighter (free... 阅读全文
摘要:
RE了无数次,貌似是数组开小了。状态为坐标+下一个方向代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--#include<iostream>#include<cstring>#include<cstdio>usin... 阅读全文
摘要:
bfs,主要是用pre记录前驱,输出路径。代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--#include<iostream>#include<cstdio>#include<cstring>#include&l... 阅读全文
摘要:
Def: Phi(n) = # of factors a s.t. (a, n) = 1Thm: Let p1, p2... pk be all prime factors of n,then,Phi(n) = n(1 - 1/p1)(1 - 1/p2)... (1 - 1/pk).Proof 1:It suffices to show that1) Phi(p) = p2) Phi(p^k) =... 阅读全文