2013年6月17日
摘要: //简单DP,状态转移方程:dp[i] = max( a[i], a[i]+dp[i-1] )#include <iostream>#include <cstring>#include <cmath>using namespace std;int a[100005];int main(){ int t, n, cnt=0; cin >> t; while (t--) { cin >> n; int i; for (i=0; i<n; i++) cin >> a[i]; //start = ma... 阅读全文
posted @ 2013-06-17 19:40 soul214j 阅读(103) 评论(0) 推荐(0)
  2013年6月16日
摘要: #include <iostream>#include <cstring>#include <cmath>using namespace std;char map[9][9];int n, m, t, di, dj;int dir[4][2] = {{0,-1}, {0, 1}, {1, 0}, {-1, 0}};//四个方向bool escape;void dfs(int si, int sj, int cnt){ int i, temp; if (si>n || si<=0 || sj>m || sj<=0) //边界 retur 阅读全文
posted @ 2013-06-16 20:17 soul214j 阅读(125) 评论(0) 推荐(0)
摘要: #include <iostream>#include <set>#include <string>#include <sstream> //使用stringstream需要用到的头文件using namespace std;string str;set<string> article; //set中不会有重复的元素int main(){ while (getline(cin, str) && str != "#") //getline(cin, string)可以接收空格,遇到换行结束 { str 阅读全文
posted @ 2013-06-16 15:38 soul214j 阅读(112) 评论(0) 推荐(0)
摘要: //好吧,水了。。。#include <cstdio>#include <cmath>#define PI 3.1415926using namespace std;//返回值是弧度,需要转换成角度double angle(double x1, double y1, double x2, double y2){ double dtheta,theta1,theta2; theta1 = atan2(y1,x1); theta2 = atan2(y2,x2); dtheta = theta2 - theta1; while (dtheta > PI) ... 阅读全文
posted @ 2013-06-16 14:33 soul214j 阅读(133) 评论(0) 推荐(0)
  2013年6月3日
摘要: 作为一个新手,继续努力。。。没有打表,直接做的。1156MS,348K,这是要超时的迹象(╯﹏╰)b #include <iostream> #include <cmath> #include <cstring> using namespace std; int n, visited[20], res[20]; int isPrime(int x) { int i; if (x <= 1) return 0; for (i=2; i<=sqrt(x); i++) if (x % i == 0) return 0;... 阅读全文
posted @ 2013-06-03 22:04 soul214j 阅读(125) 评论(0) 推荐(0)