桑海

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2013年5月21日

摘要: 1 #include<iostream> 2 #include<string> 3 #include<iomanip> 4 #include<algorithm> 5 using namespace std; 6 7 #define MAXN 9999 8 #define MAXSIZE 10 9 #define DLEN 4 10 11 class BigNum 12 { 13 private: 14 int a[500]; //可以控制大数的位数 15 int len; //大数长度 16 public: 17 BigNum... 阅读全文
posted @ 2013-05-21 21:36 桑海 阅读(340) 评论(0) 推荐(0) 编辑

摘要: 本文对Windows平台下常用的计时函数进行总结,包括精度为秒、毫秒、微秒三种精度的5种方法。分为在标准C/C++下的二种time()及clock(),标准C/C++所以使用的time()及clock()不仅可以用在Windows系统,也可以用于Linux系统。在Windows系统下三种,使用Windows提供的API接口timeGetTime()、GetTickCount()及QueryPerformanceCounter()来完成。文章最后给出了5种计时方法示例代码。标准C/C++的二个计时函数time()及clock()time_ttime(time_t *timer);返回以格林尼治时 阅读全文
posted @ 2013-05-21 18:21 桑海 阅读(309) 评论(0) 推荐(0) 编辑

摘要: WA了三次;仅仅是因为输出输入数据时,先去了了前导0.罪过啊!! 1 #include<iostream> 2 #include<string> 3 #include<limits> 4 #include<sstream> 5 using namespace std; 6 7 inline string reverse(const string a) 8 { 9 string t(a.rbegin(), a.rend()); 10 return t; 11 } 12 string operator + (const string& a, 阅读全文
posted @ 2013-05-21 12:17 桑海 阅读(265) 评论(0) 推荐(0) 编辑

2013年5月17日

摘要: 其实很多事情都是自己关注的太多了,有时候为避免“灵魂阻塞”,要时常的清理下垃圾,剪掉繁枝冗叉。才能更挺拔的与仰望天空。很喜欢这句话“残破的天空下,你也曾低低飞翔,即使吃鱼沉重,依旧头颅高昂。世界会淡忘每一颗破碎的心,然而,风总会轻轻的吹过,让新的梦想生生不息……”做好自己本分的事情就好…… 阅读全文
posted @ 2013-05-17 20:13 桑海 阅读(157) 评论(0) 推荐(0) 编辑

2013年4月8日

摘要: 1413 1 /*只能打表了*/ 2 #include<iostream> 3 //#include<fstream> 4 //#include<sstream> 5 //#include<ctime> 6 //#include<cmath> 7 using namespace std; 8 //ofstream fout("C:\\Users\\桑海\\Desktop\\Temporary\\out2.txt"); 9 10 const int maxn = 780 + 5; 11 int p[maxn] = { 阅读全文
posted @ 2013-04-08 12:57 桑海 阅读(235) 评论(0) 推荐(0) 编辑

2013年4月7日

摘要: 1029 1 #include<iostream> 2 #include<vector> 3 #include<algorithm> 4 using namespace std; 5 6 int main() 7 { 8 int odd; 9 while(cin >> odd)10 {11 int x;12 vector<int> ivec;13 for(int i = 0; i < odd; ++i)14 {15 cin >> x;16 ivec.push... 阅读全文
posted @ 2013-04-07 20:54 桑海 阅读(145) 评论(0) 推荐(0) 编辑

2013年4月4日

摘要: 1002:1002 1 #include<iostream> 2 #include<string> 3 using namespace std; 4 5 #define P(x) \ 6 cout << #x " " << x << ":" << endl; 7 8 #define PE(a, b, c, sum) \ 9 cout << a << " + " << b << " = " < 阅读全文
posted @ 2013-04-04 21:11 桑海 阅读(251) 评论(0) 推荐(0) 编辑

摘要: Bign 1 #include<iostream> 2 #include<string> 3 #include<cstring> 4 #include<cstdio> 5 using namespace std; 6 const int maxn = 1000 + 5; 7 8 class bign 9 { 10 public: 11 int len, s[maxn]; 12 bign() 13 { 14 len = 0; 15 memset(s, 0, sizeof(s)); 16 ... 阅读全文
posted @ 2013-04-04 17:05 桑海 阅读(3550) 评论(0) 推荐(0) 编辑

2013年4月3日

摘要: 第一次没仔细审题:View Code 1 #include<iostream> 2 #include<sstream> 3 #include<string> 4 #include<vector> 5 using namespace std; 6 7 class stu 8 { 9 public: 10 int sol; 11 string time; 12 int h, m, s;//对应的时分秒 13 int score;//得分 14 bool sm;//标志是否是最小的那个(默认是) 15 stu() 16 {... 阅读全文
posted @ 2013-04-03 21:10 桑海 阅读(253) 评论(0) 推荐(0) 编辑

摘要: runtimeerror(运行时错误)就是程序运行到一半,程序就崩溃了。比如说:①除以零②数组越界:inta[3];a[10000000]=10;③指针越界:int*p;p=(int*)malloc(5*sizeof(int));*(p+1000000)=10;④使用已经释放的空间:int*p;p=(int*)malloc(5*sizeof(int));free(p);*p=10;⑤数组开得太大,超出了栈的范围,造成栈溢出:inta[100000000];如果你用的是WindowsXP操作系统,那么RuntimeError的界面一般如下: 阅读全文
posted @ 2013-04-03 20:36 桑海 阅读(318) 评论(0) 推荐(0) 编辑