1083 - #include #include #include...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<iostream> #include<set> #include<vector> #include<string> using namespace std; enum { SIZ = 32, }; struct Node { int l,r,u,d; bool enable; set<int> ptr; set<int> next; }; Node tab[SIZ]; set<string> result; void init(){ for(int i=0;i<SIZ;i++){ tab[i].u=tab[i].l=tab[i].r=tab[i].d = -1; tab[i].enable = false; tab[i].ptr.clear(); tab[i].next.clear(); } } int h,w,m; int dat[SIZ][SIZ]; char buf[SIZ]; int top; void readIn(){ int i,j; char t; m = 0; for(i=0;i<h;i++){ for(j=0;j<w;j++){ cin>>t; if(t == '.'){ dat[i][j] = -1; continue; } t -= 'A'; if(m < t) m = t; dat[i][j] = t; tab[t].enable = true; if(tab[t].u == -1 || tab[t].u < i){ tab[t].u = i; } if(tab[t].d == -1 || tab[t].d > i){ tab[t].d = i; } if(tab[t].l == -1 || tab[t].l > j){ tab[t].l = j; } if(tab[t].r == -1 || tab[t].r < j){ tab[t].r = j; } }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
} m++; } set<int>::iterator it; for(it=s.begin(); it!=s.end(); it++){ cout<<" "<<char(*it + 'A'); } cout<<endl; } void print(int cur){ cout<<"Number of "<<char(cur+'A')<<" depends: "<<tab[cur].ptr.size()<<endl;
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/18/2010 for the course CS 100 taught by Professor Acm during the Spring '10 term at Zhejiang University.

Page1 / 3

1083 - #include #include #include...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online