随笔分类 -  ***模板***

摘要:1 //SG函数打表 2 const int MAX_DIG = 64; 3 4 // SG打表 5 // f[]:可以取走的石子个数 6 // sg[]:0~n的SG函数值 7 // hash[]:mex{} 8 int f[MAX_DIG]; 9 int sg[MAX_DIG]; 10 int 阅读全文
posted @ 2017-10-24 22:35 yijiull 阅读(106) 评论(0) 推荐(0)
摘要:星期几问题 1 /* 2 * 已知1752年9月3日是Sunday,并且日期控制在1700年2月28日后 3 */ 4 char name[][15] = { "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "s 阅读全文
posted @ 2017-10-23 13:09 yijiull 阅读(160) 评论(0) 推荐(0)
摘要:Java大数 1 import java.util.*; 2 import java.math.*; 3 4 public class Main { 5 public static void main(String args[]) { 6 int a = 102; 7 BigInteger x = 阅读全文
posted @ 2017-10-20 18:10 yijiull 阅读(127) 评论(0) 推荐(0)
摘要:二维几何相关(未完全测试) 基础+凸包+旋转卡壳+半平面交 1 /************************************************************************* 2 > File Name: board.cpp 3 > Author: yijiul 阅读全文
posted @ 2017-09-22 09:57 yijiull 阅读(193) 评论(0) 推荐(0)
摘要:非递归线段树(未测试) 1 const int maxn=1e5+10; 2 int a[maxn],n; //原数组,从1开始 3 struct SegTree{ 4 int N; 5 int sum[maxn<<2],add[maxn<<2]; 6 7 //建树 8 void build(){ 阅读全文
posted @ 2017-08-05 01:03 yijiull 阅读(185) 评论(0) 推荐(0)
摘要:1 const int maxn=65; 2 struct Matrix 3 { 4 int n,m[maxn][maxn]; 5 void init(int sz) 6 { 7 memst(m,0,sizeof(m)); 8 n=sz; 9 } 10 Matrix(int sz=0){init(s 阅读全文
posted @ 2017-07-30 11:17 yijiull 阅读(120) 评论(0) 推荐(0)
摘要:manacher 1 //返回s的最长回文子串的长度 2 int Manacher(char* s){ 3 int len=strlen(s); 4 for(int i=len;i>=0;i--){ 5 s[2*i+2]=s[i]; 6 s[2*i+1]='#'; 7 } 8 s[0]='*'; 9 阅读全文
posted @ 2017-07-27 21:26 yijiull 阅读(204) 评论(0) 推荐(0)
摘要:加减乘除 1 //compare比较函数:相等返回0,大于返回1,小于返回-1 2 int compare(string str1,string str2) 3 { 4 if(str1.length()>str2.length()) return 1; 5 else if(str1.length() 阅读全文
posted @ 2017-07-25 22:20 yijiull 阅读(194) 评论(0) 推荐(0)
摘要:dijkstra 1 const int inf=0x3f3f3f3f; 2 const int maxv=1010; 3 const int maxe=1010; 4 5 struct Edge 6 { 7 int u,v,w; 8 int nex; 9 }e[maxe<<1]; 10 int h 阅读全文
posted @ 2017-07-23 13:14 yijiull 阅读(209) 评论(0) 推荐(0)