HDU4565 && 2013年长沙邀请赛A题】的更多相关文章

部分转自http://blog.csdn.net/crazy______/article/details/9021169 #include<cstdio> using namespace std; __int64 A[3][3],s[3][3],tmp[3][3]; void fun(__int64 n,__int64 m) { __int64 i,j,k; for(i=1;i<=2;i++) for(j=1;j<=2;j++) { s[i][j]=A[i][j]; } --n;…
思路: 每次枚举删除一个点,然后对剩下的点求出关键点,判断删除哪个关键点获得的连通分支数最大. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include<map> #define Maxn 5100 #define Maxm 50100 #define inf 0x7fffffff using n…
Special equations Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 178    Accepted Submission(s): 87 Special Judge Problem Description Let f(x) = a nx n +...+ a 1x +a 0, in which a i (0 <= i <=…
Hypersphere Time Limit: 1 Second       Memory Limit: 32768 KB In the world of k-dimension, there's a large hypersphere made by mysterious metal. People in the world of k-dimension are performing a ceremony to worship the goddess of dimension. They ar…
2013年山东省赛F题 Mountain Subsequences先说n^2做法,从第1个,(假设当前是第i个)到第i-1个位置上哪些比第i位的小,那也就意味着a[i]可以接在它后面,f1[i]表示从第一个开始,以a[i]为结尾的不同递增序列的个数,要加上1,算上本身.正反各跑一遍,答案加一下(f1[i]-1)*(f2[i]-1)优化就是,比a[i]小的,只有a[i]-1个 #include<iostream> #include<cstdio> #include<queue&…
2013年省赛H题你不能每次都快速幂算A^x,优化就是预处理,把10^9预处理成10^5和10^4.想法真的是非常巧妙啊N=100000构造两个数组,f1[N],间隔为Af2[1e4]间隔为A^N,中间用f1来填补f[x]=f1[x%N]*f2[x/N]%P; #include<iostream> #include<cstdio> #include<queue> #include<algorithm> #include<cmath> #inclu…
2013年省赛I题判断单向联通,用bfs剪枝:从小到大跑,如果遇到之前跑过的点(也就是编号小于当前点的点),就o(n)传递关系. bfs #include<iostream> #include<cstdio> #include<queue> #include<algorithm> #include<cmath> #include<ctime> #include<set> #include<map> #inclu…
题目链接:http://icpc.njust.edu.cn/Contest/194/Problem/B B - TWO NODES 时间限制: 10000 MS 内存限制: 65535 KB 问题描述 Suppose that G is an undirected graph, and the value of  stab is defined as follows: Among the expression, G-i,-j  is the remainder after removing no…
So Easy! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2286    Accepted Submission(s): 710 Problem Description A sequence Sn is defined as:Where a, b, n, m are positive integers.┌x┐is the ceil…
这题当时竟然没看啊…… 找规律:求和m+m+m-1+m-1+……前n项 ;}…