几经波折虽然写出了递归式,但是一提交,超时。然后改成了不用递归,先算出所有值,存到数组里,结果WA。然后发现,n=100时数太大太大,要用大数来处理。不想写大数的程序,所以改用java写,终于ACC++的两个版本:View Code 1 #include <stdio.h> 2 #include <string.h> 3 int connection[201]; 4 int connect(int m,int n) 5 { 6 if(n==m+1) 7 return 1; 8 if(m>=n) 9 return 1;10 //n>m+1... Read More
posted @ 2012-10-12 22:13 sidereal Views(255) Comments(0) Diggs(0)
测试数据没有问题的,但是不知为什么超时先转为后缀表达式,把括号去掉;再转为中缀表达式,转化成输出形式转化过程,想清楚了其实很简单 1 #include <string> 2 #include <iostream> 3 using namespace std; 4 int grade(char ch) 5 { 6 switch(ch) 7 { 8 case '*': 9 case '/': 10 return 2; 11 case '+': 12 case '-': 13 ... Read More
posted @ 2012-10-12 20:41 sidereal Views(240) Comments(0) Diggs(0)