摘要: http://acm.fzu.edu.cn/problem.php?pid=1759View Code //A^x = A^(x % Phi(C) + Phi(C)) (mod C) 的应用const int MM = 1111111;#define debug puts("wrong")typedef __int64 int64;const double lep=1e-10;int64 N,mod; char str[MM];int64 euler(int64 x) { int64 i, res=x; for(i=2;(i*i)<=x;i++) { if(x%i== 阅读全文
posted @ 2013-05-06 20:06 zhang1107 阅读(135) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1556View Code //区间标记, 当然对于任意修改都能做const int MM = 111111;#define debug puts("wrong")const double lep=1e-10;int N,num[MM];void solve() { int i,j,k,x,y; memset(num,0,sizeof(num)); for(i=0;i<N;i++) { scanf("%d%d",&x,&y); num[x]++, n 阅读全文
posted @ 2013-05-06 19:43 zhang1107 阅读(103) 评论(0) 推荐(0) 编辑
摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1686View Code //存在到0边的奇数步的路,则先手胜const int MM = 11111;#define inf 0x3f3f3f3f#define debug puts("wrong")typedef long long int64;int N,M;int num[MM];void get_data() { int i,j,k; scanf("%d",&N); for(i=0;i<N;i++) scanf( 阅读全文
posted @ 2013-05-06 18:47 zhang1107 阅读(147) 评论(0) 推荐(0) 编辑
摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1684View Code //重新建树,求两点间最短距离const int MM = 11111;#define inf 0x3f3f3f3f#define debug puts("wrong")typedef long long int64;int num[MM], N, tot;int chd[MM], len; //节点的儿子个数bool vis[MM];vector<int>edge[MM];struct Info{int node,s 阅读全文
posted @ 2013-05-06 18:13 zhang1107 阅读(203) 评论(0) 推荐(0) 编辑
摘要: View Code const int maxn = 111; //方程大小int m, n; // 行号 列号double a[maxn][maxn], x[maxn]; //x为结果void Gauss() { double d = 0, t = 0, sum = 0; int k = 1, l = 0, i = 0, j = 0; while (k <= n) { //*****选主元素***** d = a[k][k]; l = k; ... 阅读全文
posted @ 2013-05-06 12:22 zhang1107 阅读(112) 评论(0) 推荐(0) 编辑