摘要:
http://acm.sdut.edu.cn/sdutoj/showproblem.php?pid=2482&cid=1184 1 #include 2 #include 3 #include 4 using namespace std; 5 typedef struct node 6 { 7 char data; 8 struct node *l,*r; 9 } treenode,*tree;10 char s[30],s1[30],s2[30];11 int c=0;12 int insert(tree *t,char x)13 {14 t... 阅读全文
摘要:
http://acm.sdut.edu.cn/sdutoj/showproblem.php?pid=2484&cid=1182写的代码很复杂先转换成后缀式再建立表达式树 1 #include 2 #include 3 #include 4 5 #define MAXN 100 6 int comp(char a, char b) 7 { 8 if(a == '(') return 0; 9 if(a=='*' || a=='/') return 1; 10 else if((a=='+' || a=='-' 阅读全文
摘要:
http://poj.org/problem?id=1265 1 #include 2 #include 3 #include 4 #include 5 int n; 6 using namespace std; 7 const int maxn=100; 8 const double pi=acos(-1.0); 9 int gcd(int a,int b)10 {11 return b==0?a:gcd(b,a%b);12 }13 struct Point //点的定义14 {15 double x,y;16 Point() {}17 Point (dou... 阅读全文
摘要:
http://poj.org/problem?id=3278 1 Source Code 2 3 Problem: 3278 User: SDUT_NULL 4 Memory: 1068K Time: 63MS 5 Language: G++ Result: Accepted 6 7 Source Code 8 #include 9 #include10 #include11 #include12 #include13 bool s[200010];14 using namespace std;15 struct node16 {17 int num;18 i... 阅读全文