代码: 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 vector cs = {"","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"}; 8 vector *r.....
分类:
其他好文 时间:
2015-04-15 00:58:16
阅读次数:
106
#includeusing namespace std;#define Maxsize 100class Date{public: int date[Maxsize + 1]; /*存储时按照1到n下标存储,空出下标为0的位置*/};int mindsearch(Date&A, int k, int...
分类:
其他好文 时间:
2015-04-15 00:57:12
阅读次数:
112
A题有很多可行的构造方法,我是采取的对于每个数 i和 i+n/2配对的方式。对于4特别处理,为2 4 1 3。#include#includeusing namespace std;int main(){ int n; cin>>n; if(n==1) { co...
分类:
其他好文 时间:
2015-04-15 00:54:30
阅读次数:
183
随手写了个进制转换的,低级但也有几点注意的:#include#include#includeusing namespace std;stack si;/*这里采用空间换时间的做法,而且可以扩展成任意想要的表示法*/char c_arr[36]={'0','1','2','3','4','5','6'...
分类:
其他好文 时间:
2015-04-15 00:50:26
阅读次数:
178
首先想到一种很快速的方法求回文子串,就是枚举一下子串的中间位置,然后向两边扩展比较!但是这时候会出现一个问题那就是当这个串本身是一个重复串只有一个字符的时候那这个算法就是一个n^2的算法,但是这个算法本身对于其他数据是很有价值的,所以只需要对这种重复的串的问题可以单独进行一下处理就可以很快的完成求解
#include
#include
using namespace std;
cha...
分类:
其他好文 时间:
2015-04-14 23:20:54
阅读次数:
147
namespace 打印乘法口诀{ class Program { static void Main(string[] args) { for (int i = 1; i <=9; i++)//行数循环九次, { for (int j = 1; j<=i; j++)//当i等于1的时候,j等于1, ...
分类:
其他好文 时间:
2015-04-14 23:07:04
阅读次数:
127
#includeusing namespace std;class poly{public: int coef; int expon; poly *next;};poly*input(); /*输入函数*/poly*attach(poly*...
分类:
其他好文 时间:
2015-04-14 23:05:54
阅读次数:
203
#include#includeusing namespace std;#define MOD 1000000007typedef long long ll;ll F[16][16][16][16][16][6];ll f(int a,int b,int c,int d,int e,int pre)...
分类:
其他好文 时间:
2015-04-14 23:00:14
阅读次数:
212
#include#include#include#includeusing namespace std;int m,n;int SG[1000001];int sg(int x){ if(SG[x]!=-1) return SG[x]; if(!x) return SG[x]=0; setS; in...
分类:
其他好文 时间:
2015-04-14 22:51:37
阅读次数:
141
代码: 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 int threeSumClosest(vector &num, int target) { 8 sort(num.begin(),num.end()); ...
分类:
其他好文 时间:
2015-04-14 22:50:51
阅读次数:
119