- 博客(13)
- 资源 (2)
- 收藏
- 关注
原创 HDU 1518 Square
解题思路:sum%4!=0 , max #include #include #include #include #include using namespace std; int a[100]; bool vis[100],flag; int m,ave; bool dfs(int ans,int sum,int cnt){ if(sum==ave) ret
2013-12-17 00:10:12 754
原创 HRBUST 1908 A+B+C 高精度加法
SOL:小学数学规则,模拟即可。 第一个常见的板子 (通用性较小) 5ms #include #include #define rep(i,n) for(i=1;i<=n;i++) using namespace std; const int maxn = 1000 + 10; char str1[maxn],str2[maxn],str3[maxn]; int i,len1,l
2013-12-17 00:08:33 672
原创 SGU 130 Circle 卡特兰数
Sol:根据提议可以知道就是求卡特兰数,互不相交可以分 K+1 份 我直接贴的高精度的板子。 #include #include #include #include using namespace std; #define maxn 9999 #define maxsize 1010 #define DLEN 4 class BigNum { private: int a[50
2013-12-16 23:35:10 914
原创 SGU 133 Border 排序+枚举
Sol:就是双关键字排序,枚举一下符合题意的就OK了。 #include #include #include using namespace std; const int maxn = 16000 + 10; struct Point{ int x,y; }arr[maxn]; bool cmp(const Point &a,const Point &b) { return (
2013-12-16 22:00:09 663
原创 HDU 1134 Game of Connections 高精度卡特兰数
SoL:找个NB的板子就好,用Java才是爽。。。 #include #include #include #include using namespace std; #define maxn 9999 #define maxsize 1010 #define DLEN 4 class BigNum { private: int a[500]; int len; public:
2013-12-16 15:19:24 743
原创 SGU 107 987654321问题
Sol:打表找规律,发现后9位满足的只有8个数。。。 #include using namespace std; int main() { int n; while(~scanf("%d",&n)) { if(n<9) printf("0\n"); else if(n==9) printf("8\n"); else { n-=10; printf("72"
2013-12-16 11:02:42 1352
原创 SGU 106 The Equation 扩展欧几里得应用
Sol:线性不定方程+不等式求解 证明的去搜下别人的证明就好了。。。数学题。 #include #include #include using namespace std; long long extend_gcd(long long a,long long b,long long &x,long long &y) { if(a==0&&b==0) return -1; if(b
2013-12-15 23:59:11 836
原创 POJ 1811 Prime Test --- Miller 素数测试
SOL:学下那个算法就OK了。。。 此题向我这么写只能用C++交,要不就RE,POJ 不让那么写随机数。 #include #include #include #include #include #include using namespace std; const int S = 8;//随即算法判定 long long mult_mod(long long a,
2013-12-11 23:27:20 751
原创 Poj 2689 Prime Distance ----大区间素数筛选
Sol:筛选素数就可以了。。。。(模版题) #include #include #include #include using namespace std; const int maxn = 100000 + 10; const int maxm = 1000000 + 10; int prime[maxn+1]; void getprime() { memset(pri
2013-12-11 21:48:41 815
原创 HDU 1402 A * B Problem Plus FFT
跟着Bin哥一起学。 #include #include #include #include #include using namespace std; const double PI=acos(-1.0); struct Complex { double x,y; Complex(double _x=0.0,double _y=0.0) { x=_x; y=_y;
2013-12-10 22:37:48 679
原创 HRBUST 1987 逃课的孩子
Sol:HASH + 二分 字符串处理,很基础的操作。 题意很明确就是找重复的次数统计下,范围比较大1≤n≤10000,1≤m≤10000。 #include #include #include #include #include using namespace std; const int maxm = 10000 + 10; const int maxn = 10
2013-12-10 20:48:33 814
原创 Poj 3974 回文串--Manacher
//最长回文 #include #include #include using namespace std; const int maxn = 1000000 + 10; char Ma[maxn*2]; int Mp[maxn*2]; void Manacher(char s[],int len) { int l=0; Ma[l++]='$'; Ma[l++]='#'; f
2013-12-02 09:14:15 710
原创 HDU 3068 回文串--Manacher
//2009 Multi-University Training Contest 16 - Host by NIT //最长回文 #include #include #include using namespace std; const int maxn = 100000 + 10; char Ma[maxn*2]; int Mp[maxn*2]; void Manacher(cha
2013-12-02 09:13:17 626
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人