摘要: 利用BITSET+STRING就可以了:例如 1 #include <iostream> 2 #include <bitset> 3 #include <string> 4 5 using namespace std; 6 7 int main() 8 { 9 string str="1101001010";10 bitset<32> b(str);11 int n;12 n=b.to_ulong();13 14 cout<<n;15 16 return 0;17 } 阅读全文
posted @ 2013-04-21 22:38 码代码的猿猿 阅读(749) 评论(0) 推荐(0) 编辑
摘要: 应注意以下两点:1:no push_front on vector but we can insert before begin();2:任何 insert 或 push 操作都可能导致迭代器失效。当编写循环将元素插入到 vector 或 deque 容器中时,程序必须确保迭代器在每次循环后都得到更新 1 #include <iostream> 2 #include <vector> 3 4 using namespace std; 5 6 int main() 7 { 8 vector<int> v(2,99); 9 vector<int>:: 阅读全文
posted @ 2013-04-21 17:44 码代码的猿猿 阅读(5032) 评论(0) 推荐(0) 编辑
摘要: 纠结了好一阵子:2分(向大的方向)+精度 PieTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 7983Accepted: 2928Special JudgeDescriptionMy birthday is coming up and traditionally I'm serving pie. Not just one pie,... 阅读全文
posted @ 2013-04-21 08:34 码代码的猿猿 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 二分搜索,找小的值Monthly ExpenseTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 10057Accepted: 4114DescriptionFarmer John is an astounding accounting wizard and has realized he might run out of money... 阅读全文
posted @ 2013-04-21 06:14 码代码的猿猿 阅读(144) 评论(0) 推荐(0) 编辑