2013年6月29日

hdoj 2553 N皇后问题

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2553 1 #include 2 #include 3 using namespace std; 4 5 int n,tot,x[15]; 6 7 void dfs(int t){ 8 if(t>n) tot++; 9 else{10 for(int i=1;i>n,n) cout<<a[n]<<endl;32 return 0;33 } 阅读全文

posted @ 2013-06-29 07:26 SCNU20102200088 阅读(203) 评论(0) 推荐(0) 编辑

2013年6月28日

hdoj 1176 免费馅饼

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1176解题思路:核心为 dp[x][T]=dp[x][T]+max(dp[x-1][T+1],dp[x][T+1],dp[x+1][T+1]), 其中 1≤x≤11, 0≤T 2 #include 3 using namespace std; 4 5 int dp[15][100005]; 6 7 int max(int x,int y,int z){ 8 if(y>x) x=y; 9 if(z>x) x=z;10 return x;11 }12 13 int main(... 阅读全文

posted @ 2013-06-28 13:21 SCNU20102200088 阅读(194) 评论(0) 推荐(0) 编辑

2013年6月27日

nyoj 14 会场安排问题

摘要: 题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=14解题思路:按活动结束时间从小到大排序,优先选择小的,显然,第一个活动一定被选,按顺序依次判断下一个活动的开始时间是否大于当前被选的最后一个活动的结束时间,若是,选之,否则,跳过。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 struct T{ 7 int Bi,Ei; 8 bool operator Max){23 num++;24 ... 阅读全文

posted @ 2013-06-27 22:03 SCNU20102200088 阅读(196) 评论(0) 推荐(0) 编辑

2013年6月22日

hdoj 1575 Tr A

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1575解题思路:矩阵快速幂 1 #include 2 using namespace std; 3 4 int n; //nxn矩阵 5 6 struct Matrix{ 7 int a[10][10]; 8 }origin,res; 9 10 Matrix multiply(Matrix x,Matrix y){11 Matrix temp;12 for(int i=0;i>=1;26 origin=multiply(origin,origin);27... 阅读全文

posted @ 2013-06-22 13:53 SCNU20102200088 阅读(235) 评论(0) 推荐(0) 编辑

2013年6月18日

poj 1163 The Triangle

摘要: 题目链接:http://poj.org/problem?id=1163解题思路:核心为 a[i-1][j]=a[i-1][j]+max(a[i][j],a[i][j+1]), 其中 1 2 using namespace std; 3 4 int main(){ 5 int n,i,j,a[101][101]; 6 cin>>n; 7 for(i=1;i>a[i][j]; 9 }10 for(i=n;i>1;i--){11 for(j=1;ja[i][j+1]? a[i][j]:a[i][j+1]);13 }14 ... 阅读全文

posted @ 2013-06-18 23:27 SCNU20102200088 阅读(219) 评论(0) 推荐(0) 编辑

导航