上一页 1 ··· 40 41 42 43 44 45 46 47 48 ··· 50 下一页
摘要: #includeusing namespace std;int a[5];//默认初始化为0int main(){ int b[5];//随机值 int c[5]={3};// c[0]=3,其他初始化0 return 0;} 阅读全文
posted @ 2014-08-06 11:29 gongpixin 阅读(589) 评论(0) 推荐(0) 编辑
摘要: algorithm 简单用法#include #include #include using namespace std;int student_Score[] = { 50,80,93,23,66};void pritit(int nScore){ cout= 60;}int main(int a... 阅读全文
posted @ 2014-08-05 20:54 gongpixin 阅读(482) 评论(0) 推荐(0) 编辑
摘要: 1.不可读入空格#include#includeusing namespace std;int main(){ char c[50]; scanf("%s",c); printf("%s",c); return 0;}2.可以读入空格用字符 ^ 可以说明补集。把 ^ 字符放为扫描集的第一字符时,构成... 阅读全文
posted @ 2014-08-05 15:41 gongpixin 阅读(213) 评论(0) 推荐(0) 编辑
摘要: C和C++的标准里从来没有定义过fflush(stdin)。也许有人会说:“可是我用fflush(stdin)解决了这个问题,你怎么能说是错的呢?”的确,某些编译器(如VC6)支持用fflush(stdin)来清空输入缓冲,但是并非所有编译器都要支持这个功能(linux下的gcc就不支持),因为标准... 阅读全文
posted @ 2014-08-05 15:16 gongpixin 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 1.做题时偶然发现,else if()语句太多,也会造成超时,应该避免不必要的else if()语句,能用else 的直接用else ,别再加 else if()来判断了。见我的一个例子 POJ 1577 Falling Leaves(二叉搜索树)其实并非如此。。。else if一般不会导致超时,,... 阅读全文
posted @ 2014-08-05 09:41 gongpixin 阅读(238) 评论(0) 推荐(0) 编辑
摘要: 思路:当时学长讲了之后,似乎有点思路----------就是倒着建一个 二叉搜索树代码1:超时详见超时原因#include#include#includeusing namespace std;char c[100][100];struct node{ char c; node *lchild; n... 阅读全文
posted @ 2014-08-04 17:28 gongpixin 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 看到网上的说是,右结合但是还是从左往右算// 以下说法是从网上看的,不知道对不a ? b : c ? d : e 如何进行呢?它的结合律是从右向左,所以它等效于 a ? b : ( c ? d : e )运算还是从左向右,所以先判断a,cde都可能不会被算到。运算只会从左向右,不存在从右向左。除非有... 阅读全文
posted @ 2014-08-04 15:29 gongpixin 阅读(687) 评论(0) 推荐(0) 编辑
摘要: 运算顺序有关,详见运算符优先级代码1:#includeusing namespace std;int main(){ char c; int m=0; while( c= getchar(c) &&c!='\n') { m++; coutusing namespace std;int main(... 阅读全文
posted @ 2014-08-04 15:13 gongpixin 阅读(411) 评论(0) 推荐(0) 编辑
摘要: 1.long longVC中不能用,codeblocks中 可以#include#includeusing namespace std;int main(){ long long a; scanf("%lld",&a); printf("%lld",a); return 0;}2.__int64VC... 阅读全文
posted @ 2014-08-03 23:34 gongpixin 阅读(392) 评论(0) 推荐(0) 编辑
摘要: 思路:哈夫曼树,用优先队列,简单#include#include#includeusing namespace std;int main(){ priority_queue,greater > q;//从小到大 的优先队列 int n; scanf("%d",&n); int l; while(n-... 阅读全文
posted @ 2014-08-03 23:17 gongpixin 阅读(149) 评论(0) 推荐(0) 编辑
上一页 1 ··· 40 41 42 43 44 45 46 47 48 ··· 50 下一页