上一页 1 2 3 4 5 6 ··· 9 下一页
摘要: The rule is simple. First determin the number of rows to print, then for every row follow the rule.Total rows = 2n + 1.The ith row has 2i + 1 digits to print, from 0 to i then to 0.The ith row skip 2n - 2i spaces.Accepted.#include <stdio.h>#include <string.h>int main() { int n; scanf(&qu 阅读全文
posted @ 2011-10-09 10:09 DOF_KL 阅读(283) 评论(0) 推荐(0) 编辑
摘要: typedef struct ufs_elem_st { struct ufs_elem_st *next, *prev; struct ufs_elem_st *parent;} ufs_elem_st, *ufs_elem_t;typedef struct ufs_st { ufs_elem_st *roots;} ufs_st, *ufs_t;ufs_elem_t ufs_get_root(ufs_elem_t me) { ufs_elem_t my_root = me; while( my_root->parent != my_root && my_roo... 阅读全文
posted @ 2011-09-18 14:40 DOF_KL 阅读(194) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std;typedef struct ufs_elem_st { struct ufs_elem_st *next, *prev; struct ufs_elem_st *parent;} ufs_elem_st, *ufs_elem_t;typedef struct ufs_st { ufs_elem_st *roots;} ufs_st, *ufs_t;typedef struct star_st { ufs_elem_st ufs_elem; int x,y,z,r;} star_st, ... 阅读全文
posted @ 2011-09-18 14:39 DOF_KL 阅读(336) 评论(0) 推荐(0) 编辑
摘要: 首先要下载GLUT的库文件,http://www.xmission.com/~nate/glut.html我是选择这里下的解压后是网上的教程有在http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip这里下的解压后是前者没有glut.dll,但glut.h和glut32.dll的size要大一点,估计是修整后的版本,所以我选择了前者。然后就是参考网上的配置教程glut.h --> C:\Program Files\Microsoft SDKs\Windows\v7.0A\Includeglut32.dll --&g 阅读全文
posted @ 2011-09-17 15:31 DOF_KL 阅读(1632) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std;int X,Y,K,B;int X_value[33] = { 0 }, X_len;int Y_value[33] = { 0 }, Y_len;unsigned long long count_Y, count_X, ret;void to_base(int base, int *new_value, int *value_len, int value) { int mod, div, len=0; while( value ) { div = value / base; ... 阅读全文
posted @ 2011-09-17 13:30 DOF_KL 阅读(302) 评论(0) 推荐(0) 编辑
摘要: 判断两int相乘是否溢出,目前找到的最正确方式:int is_mul_overflow(int a, int b) { if( a >= 0 && b >=0 ) { return INT_MAX / a < b; } else if( a < 0 && b < 0 ) { return INT_MAX / a > b; } else if( a * b == INT_MIN ) { return 0; } else { return a < 0 ? is_mul_overflow(-a, b... 阅读全文
posted @ 2011-09-12 17:05 DOF_KL 阅读(9851) 评论(4) 推荐(1) 编辑
摘要: #include <iostream>using namespace std;double len,h1,h2,h3,h4;double sb_cal(double h_counter, double h_adj1, double h_adj2) { double hx, rebuild_V, l1, l2, rm_part_V, final_V; if( h_counter < h_adj1 + h_adj2 ) return -1; hx = h_counter - (h_adj1 + h_adj2); if( hx < 0 ) // 有一个点为0,但... 阅读全文
posted @ 2011-09-12 13:27 DOF_KL 阅读(195) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <map>#include <string>using namespace std;int counter[10001] = { 0 };int ret = -1;int to_digit(char color) { switch(color) { case 'A': return 0; case 'B': return 1; case 'C': return 2; case 'G': return 3; case 'O': 阅读全文
posted @ 2011-08-18 10:40 DOF_KL 阅读(206) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <string>#include <vector>#include <algorithm>using namespace std;typedef pair<int, int> word_index;typedef pair<int, int> lv1_index;#define NOT_VALUE 0xfffffffftypedef struct dp_item { int min_word_amount; int min_word_seq[200]; //最长的wo 阅读全文
posted @ 2011-08-16 15:16 DOF_KL 阅读(229) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <string>using namespace std;int len = 0, buf_len = 0;char output[255 * 1000 + 2000] = { '\0' }, buf[300] = { '\0' };char c;int main() { //FILE *p = fopen("in.txt", "r"); while(scanf("%c", &c) != EOF) { if( c &g 阅读全文
posted @ 2011-08-07 16:33 DOF_KL 阅读(173) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 9 下一页