摘要: 这不是一道什么竞赛题目,就是刘汝佳老师在算法竞赛入门经典中给的关于二叉树的例子。自己写了一下,附到博客园上面来供自己回忆;第一种解法是设了一个ok判断球是往左还是往右,但是要开一个2^20的数组,用来记录每个位置的0/1开关情况。这个代码很简单,在书的100页有详细的讲解。View Code 1 #include<stdio.h> 2 #include<string.h> 3 #define max 20 4 int str[1<<max]; 5 int ok; 6 int main() 7 { 8 int a,b; 9 while(scanf(" 阅读全文
posted @ 2012-04-18 22:44 SmallMushroom 阅读(177) 评论(0) 推荐(0) 编辑