上一页 1 ··· 15 16 17 18 19
摘要: 给出n个单词,如果一个单词的尾和另一个单词的头字符相等,那么可以相连,问这n个单词是否可以排成一列。欧拉路应用,构图:一个单词的头尾字母分别作为顶点,每输入一个word,该word的头指向word的尾画一个有向边,并且记录每个顶点的出入度。利用dfs先判断是否为一个连通图,如果是的话则判断是否有且仅... 阅读全文
posted @ 2014-07-28 13:01 ACBingo 阅读(312) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include using namespace std;const char*dirs="NESW";const char*turns="FLR";int r0,c0,dir,r1,c1,r... 阅读全文
posted @ 2014-07-26 17:45 ACBingo 阅读(306) 评论(1) 推荐(0) 编辑
摘要: #include #include int main(){ int n; scanf("%d", &n); char s[100]; while(n--) { scanf("%s", s); int len = strlen(s); ... 阅读全文
posted @ 2014-07-25 23:17 ACBingo 阅读(454) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std;int main(){double c,h,o,n;int t,i,j;cin>>t;getchar();double ans;char s[100];while (t-->0){gets(s);c=0;h... 阅读全文
posted @ 2014-07-25 23:16 ACBingo 阅读(958) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std;int main(){ char s[100]; int i,j,n,ans; cin>>n; getchar(); while (n>0) { n--; ... 阅读全文
posted @ 2014-07-25 23:15 ACBingo 阅读(373) 评论(0) 推荐(0) 编辑
摘要: 水题,1A过的数据才100,o(n^3)都能过,感觉用优先队列来做挺麻烦的,直接暴力就可以了,模拟的队列,没用stl#include #include #include #include #include #define maxn 100+5using namespace std;int mid[m... 阅读全文
posted @ 2014-07-24 16:20 ACBingo 阅读(414) 评论(0) 推荐(0) 编辑
摘要: 这题居然是1A过的.....最近无比失落的心情顿时愉悦起来~将数据全部读入先用二维数据来存储坐标(先把题做出来再说= =)题目中的x,y的坐标范围是-1W到1W....在数组下标里是不能用负数保存的(当然你偏用map当额没说= =),其实可以把x坐标左移1W个单位,这样最小坐标就从0开始了然后随便找... 阅读全文
posted @ 2014-07-24 14:57 ACBingo 阅读(634) 评论(0) 推荐(0) 编辑
上一页 1 ··· 15 16 17 18 19