题意: Description This problem is based on an exercise of David Hilbert, who pedagogically suggested that one study the theory of 4n+1 numbers. Here, we ...
分类:
其他好文 时间:
2017-02-26 14:07:30
阅读次数:
242
恢复内容开始 1、 http://www.spoj.com/problems/KAOS/ 题意:给定n个字符串,统计字符串(s1, s2)的对数,使得s1的字典序比s2的字典序要大,s1反一反(abc->cba,记为s1’)比s2’的字典序要小。 做法:先把字符串排序,当我们把s[i]当成题意中的s ...
分类:
其他好文 时间:
2017-02-21 00:49:56
阅读次数:
266
Prime Ring Problem Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 47217 Accepted Submission(s): ...
分类:
其他好文 时间:
2017-02-20 19:53:59
阅读次数:
185
String Problem Description Recently, lxhgww received a task : to generate strings contain '0's and '1's only, in which '0' appears exactly m times, '1 ...
分类:
其他好文 时间:
2017-02-18 16:48:19
阅读次数:
200
这种神奇的东西............... 参考资料:http://www.cnblogs.com/jianglangcaijin/p/3446839.html Lucas定理 适用于n很大p较小的时候 $ C_n^m\%p \ p \ is \ prime$ $ n=n_k*p^k+n_{k-1 ...
分类:
其他好文 时间:
2017-02-15 00:23:24
阅读次数:
220
版本一: 1 #include<bits/stdc++.h> 2 #define IO ios_base::sync_with_stdio(0);cin.tie(0); 3 using namespace std; 4 int prime[32770], phi[32770]; 5 int main ...
分类:
其他好文 时间:
2017-02-14 20:38:04
阅读次数:
257
题目 http://poj.org/problem?id=3126 题意 多组数据,每组数据有一个起点四位数s, 要变为终点四位数e, 此处s和e都是大于1000的质数,现在要找一个最短的路径把s变为e,每步可以做如下操作,把当前的s中的四位数上的某一位改变,比如1009可以变为2009,1008, ...
分类:
其他好文 时间:
2017-02-14 20:36:27
阅读次数:
163
#include #include #include #include #include using namespace std; int n, m; const int N = 1e4 + 100; int vis[N]; struct node { int x, step; }; queue Q... ...
分类:
其他好文 时间:
2017-02-12 23:54:25
阅读次数:
372
题意:输入两个正整数L、U(L<=U<1012),统计区间[L,U]的整数中有多少个数满足:它本身不是素数,但只有一个素因子。 分析: 1、满足条件的数是素数的倍数。 2、枚举所有的素数,以及其倍数,将满足条件且小于等于n的个数计算出来,solve(u) - solve(l - 1)即可。 ...
分类:
其他好文 时间:
2017-02-12 14:27:56
阅读次数:
187
1 #include 2 #include 3 bool prime(int n) 4 { 5 if(n==1) 6 return false; 7 int i,t=(int)sqrt(1.0*n); 8 for(i=2; i<=t; ++i) 9 if(!(n%i)) 10 return fals... ...
分类:
其他好文 时间:
2017-02-10 23:17:50
阅读次数:
194