2012年4月3日
摘要: //循环节#include <cstdio>#include <iostream>using namespace std;int f[49];int main() { int i; f[1] = f[2] = 1; int a, b, n; while (scanf("%d%d%d", &a, &b, &n), a+b+n) { for (i=3; i<49; ++i) f[i] = (a * f[i-1] + b * f[i-2]) % 7; printf ("%d\n", f[n%48]); } 阅读全文
posted @ 2012-04-03 22:21 Try86 阅读(146) 评论(0) 推荐(0)
摘要: //hash#include <cstdio>#include <cstring>#include <iostream>using namespace std;const int M = 1361;struct node {//节点 char str[16]; int count; node *next;}s[M];int maxs;char ans[16];void init() {//初始化 for (int i=0; i<M; ++i) { s[i].next = NULL; s[i].count = 0; }}unsigned ... 阅读全文
posted @ 2012-04-03 21:23 Try86 阅读(203) 评论(0) 推荐(0)
摘要: //排序+统计#include <cstdio>#include <cstring>#include <iostream>using namespace std;char str[1000][16];int cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b);}int solve(int n) { char temp[16]; int i, c, maxs, mi; qsort(str, n, sizeof(str[0]), cmp); strcpy(temp, st 阅读全文
posted @ 2012-04-03 20:40 Try86 阅读(156) 评论(0) 推荐(0)
摘要: import java.math.BigInteger;import java.util.Scanner;public class Main{ public static void main(String args[]) { Scanner reader = new Scanner(System.in); int t, cas; cas = 0; t = reader.nextInt(); while ((t--) != 0) { BigInteger a, b, c; ... 阅读全文
posted @ 2012-04-03 20:05 Try86 阅读(264) 评论(0) 推荐(0)
摘要: #include <cstdio>#include <iostream>using namespace std;int solve(int l, int r) { if (l == r) return l; return solve(l, ((l+r)>>1)) + solve(((l+r)>>1)+1, r);}int main() { int n; while (scanf("%d", &n) != EOF) { int ans = solve(1, n); printf ("%d\n\n", 阅读全文
posted @ 2012-04-03 19:28 Try86 阅读(201) 评论(0) 推荐(0)