上一页 1 ··· 152 153 154 155 156 157 158 159 160 ··· 182 下一页
摘要: 简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxl 50char w1[maxl], w2[maxl];int f1[26], f2[26];void work(char *w, int *f){ int len = strlen(w); for (int i = 0; i < len; i++) f[w[i] - 'a']++;}int ma 阅读全文
posted @ 2011-05-16 16:50 金海峰 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 递推,注意f[0] = 1;View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 31int main(){// freopen("t.txt", "r", stdin); int f[maxn] = {1,0,3,0}; for (int i = 4; i < maxn; i++) { f[i] = f[i - 2] * 3; 阅读全文
posted @ 2011-05-16 16:06 金海峰 阅读(248) 评论(0) 推荐(0) 编辑
摘要: 高精度,java快要忘没了。java使用文件输入要抛出异常。View Code import java.util.*;import java.io.*;import java.math.*;public class Main { static int[] prm = new int[1000000]; static boolean[] is = new boolean[1000000]; static int getprm(int n) { int i, j, k = 0; int s, e = (int) (Math.sqrt(0.0 + n) + 1); for (i = 0; i < 阅读全文
posted @ 2011-05-16 15:36 金海峰 阅读(350) 评论(0) 推荐(0) 编辑
摘要: 快排,注意保留一位小数。View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>#include <cmath>using namespace std;#define maxn 250005int n;long long f[maxn], sum;int main(){ //freopen("t.txt", "r", stdin); sc 阅读全文
posted @ 2011-05-16 14:21 金海峰 阅读(236) 评论(0) 推荐(1) 编辑
摘要: 简单模拟View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;#define maxn 11int n;bool map[maxn][maxn], touched;char out[maxn][maxn];void input(){ for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { char ch = getchar( 阅读全文
posted @ 2011-05-16 13:58 金海峰 阅读(188) 评论(0) 推荐(0) 编辑
上一页 1 ··· 152 153 154 155 156 157 158 159 160 ··· 182 下一页