桑海

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

04 2013 档案

摘要: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 桑海 阅读(261) 评论(0) 推荐(0)

摘要: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 桑海 阅读(160) 评论(0) 推荐(0)

摘要: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 桑海 阅读(270) 评论(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 桑海 阅读(3582) 评论(0) 推荐(0)

摘要:第一次没仔细审题: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 桑海 阅读(268) 评论(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 桑海 阅读(356) 评论(0) 推荐(0)

摘要:WC:View Code 1 #include<iostream> 2 #include<string> 3 #include<vector> 4 #include<algorithm> 5 using namespace std; 6 7 string judge(string &s) 8 { 9 int i = 0;10 for(; i < s.size() && s[i] == '0'; ++i);11 string t(s.begin()+i, s.end());12 if(i == s.si 阅读全文
posted @ 2013-04-02 21:53 桑海 阅读(221) 评论(0) 推荐(0)

摘要:View Code 1 #include<iostream> 2 using namespace std; 3 4 int f(int n) 5 { 6 int sum = 0; 7 while(n) 8 { 9 sum += n%10;10 if(sum > 9)11 sum = sum %10 + sum/10;12 n /= 10;13 }14 return sum;15 }16 int main()17 {18 int n;19 while(cin >> ... 阅读全文
posted @ 2013-04-02 20:31 桑海 阅读(199) 评论(0) 推荐(0)

摘要:刚还是还以为是简单的a==b,汗,重新审题如下:View Code 1 #include<iostream> 2 #include<string> 3 using namespace std; 4 5 int judge(char ch) 6 { 7 if(ch == '-') 8 return -1; 9 return 0;10 }11 int for_Locate(string a)12 {13 int i = 0;14 if(a[0] == '-' || a[0] == '+')15 i = 1;16 for(;.. 阅读全文
posted @ 2013-04-02 17:16 桑海 阅读(330) 评论(0) 推荐(0)

摘要:2057 1 #include<iostream> 2 #include<string> 3 using namespace std; 4 5 void reverse(string& a) 6 { 7 int len = a.size(); 8 for(int i = 0; i < len/2; ++i) 9 { 10 char t = a[i]; 11 a[i] = a[len-i-1]; 12 a[len-i-1] = t; 13 } 14 } 15 16 void exchange(s... 阅读全文
posted @ 2013-04-02 15:50 桑海 阅读(148) 评论(0) 推荐(0)