随笔分类 -  13whu_warm3(ZOJMonthly2010.10)

zoj 3432 Find the Lost Sock (ZOJ Monthly, November 2010)
摘要:题目地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3432题目思路: 其实就是找那个只出现了1次的字符串。 但是如果用数组或者map记录出现的次数,10w的数量会导致超时,学到一种神奇的方式--直接用异或处理先看代码:#include#include#includeusing namespace std;string s;char sock[9];char ans[9];int main(){ int n; cin>>n; while(cin>>n) { getchar(); n=... 阅读全文

posted @ 2013-09-20 23:21 814jingqi的ACM 阅读(124) 评论(0) 推荐(0)

zoj 4113 Cube Simulation ( ZOJ Monthly, November 2010 )
摘要:题目地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4113思路:这个就是三维数组的地址和下标之间的对应。 然后涉及到一定的变换 ,我们有一个p【a】 记录在若干次对换之后实际对应的是哪个数。 同时,为了能用find函数找回坐标,我们还要记录反函数(写作pp【a】)然后这个value超过的xyz是不要输出的。代码:#include#include#include#includeusing namespace std;int p[1010];int q[1010];int r[1010];int pp[1010];int 阅读全文

posted @ 2013-09-20 21:58 814jingqi的ACM 阅读(142) 评论(0) 推荐(0)