DescriptionThe ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices.
— It is a m...
分类:
其他好文 时间:
2015-03-10 19:29:50
阅读次数:
227
初次接触回溯法,觉得真是很好用,可以减少很多不必要的枚举。
cur变量表示进行到的当前第cur+1个数。 作为A【】的下标出现。
#include
using namespace std;
int n,vis[20],isp[100],A[30],maxn=0;
void dfs(int cur) {
if(cur==n&&isp[A[0]+A[n-1]]){
for(...
分类:
其他好文 时间:
2015-03-10 17:24:11
阅读次数:
139
bool is_prime (const vector& primes, int num){ for (const auto& prime : primes) { if (num % prime == 0) { return false; } ...
分类:
其他好文 时间:
2015-03-10 13:26:31
阅读次数:
103
题意: 求有多少对质数(a,b)满足ausing namespace std;const int INF = 1000002;bool f[INF];int ok[80000],out[10000];int n, sum, ans;void sift (int n) { for (int i...
分类:
其他好文 时间:
2015-03-09 23:57:47
阅读次数:
151
pprime解题报告—— icedream61 博客园(转载请注明出处)-------------------------------------------------------------------------------------------------------------...
分类:
其他好文 时间:
2015-03-09 22:20:03
阅读次数:
136
crypt1解题报告—— icedream61 博客园(转载请注明出处)-------------------------------------------------------------------------------------------------------------...
分类:
其他好文 时间:
2015-03-09 14:16:56
阅读次数:
133
我想了很久了,后来还是把N分解质因数,枚举各种组合,反正也不多吧,按题目条件,然后就过了。#include #include #include #include #include #define LL __int64using namespace std; LL prime[1000...
分类:
其他好文 时间:
2015-03-09 12:24:21
阅读次数:
127
问题:输入两个整数 a 和 b(5 2 #include 3 using namespace std; 4 5 const int ARR_SIZE = 5951; 6 7 const int t[ARR_SIZE] = { 8 5, 7, ...
分类:
其他好文 时间:
2015-03-09 10:50:43
阅读次数:
433
Design an algorithm to find the kth number such that the only prime factors are 3, 5, and 7.The eligible numbers are like 3, 5, 7, 9, 15 ...ExampleIf ...
分类:
其他好文 时间:
2015-03-09 07:01:19
阅读次数:
183
#include #include #includeusing namespace std;//高效判定素数bool prime(int n){ if(n==2) return true; if(n%2==0) return false; int sqrtn=(int)sqrt((double)n)...
分类:
其他好文 时间:
2015-03-08 22:56:30
阅读次数:
171