题意:
f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.
给定A,B,求f(n)。
法一:
网上较多的题解都提到了寻找1 1循环节的方法,的确非常巧妙,每位0~6,共7种可能,相邻两位共49种可能,因此循环周期至多为49,一旦出现相同数对,那么其后必相同。但是,该方法只是简单提及了49,却并...
分类:
其他好文 时间:
2015-02-09 18:27:36
阅读次数:
147
一:题目大意输入数据m,n,其中m是代表关键字的个数(每个关键字是一个字符串(但无空格)),n表示接口的数目,每一个借口由可有空格的字符串组成。现在需要对所有的接口进行扫描,找出含有关键字最多的借口并输出(若有多个都输出且不需要注意顺序)。二:题目分析本题算法难度并不大,但关键是处理字符串的技巧。详...
分类:
其他好文 时间:
2015-02-09 15:31:42
阅读次数:
100
You are given n integers. Your task is very easy. You should find the maximum integer a and the minimum integer b among these n integers.
And then you should replace both a and bwith a-b. Your task ...
分类:
其他好文 时间:
2015-02-08 15:34:12
阅读次数:
165
题目链接:点击打开链接
ZOJ 3573 Under Attack
距离做这套题到写题解间隔比较久,题意有些忘了。。
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
typedef long lon...
分类:
其他好文 时间:
2015-02-07 20:26:47
阅读次数:
251
题目:ZOJ-3132-DNA Consensus String 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 using namespace std; 9 10 char str[55][1010];.....
分类:
其他好文 时间:
2015-02-07 18:41:31
阅读次数:
139
Given a set S = {1, 2, …, n}, number m and p, your job is to count how many set T satisfies the following condition: T is a subset of S
|T| = m
T does not contain continuous numbers, that is to say...
分类:
其他好文 时间:
2015-02-07 16:01:15
阅读次数:
142
题意:
比较简单的题目,就是把给定格式的数字加起来,再按规定格式输出,想想感觉很简单,写起来还是不是很顺,wa了5次,能注意的点都注意了,重新写了一遍才过的。现在总结以下几点易错点:
1.像小于10和小于100的需要特判。
2.不要用double解,精度不能保证,最后处理也烦,建议直接把数字读出来,虽说范围是int内,但不知道数据会不会坑,最好用long long。
3.处理','的时候,...
分类:
其他好文 时间:
2015-02-07 09:11:50
阅读次数:
115
题目链接:ZOJ 3041 City Selection
题意:有N个城市坐标和M个工厂坐标,在以工厂为原点的第四象限的点都会受到污染。即图中画线区域
思路:把工厂和城市的坐标一起排序,再比较y坐标。
AC代码:
#include
#include
#include
using namespace std;
const int maxn=200010;
...
分类:
编程语言 时间:
2015-02-06 09:41:15
阅读次数:
159
很简单的一题,注意墙上的影子是放大就行。用三分。#include #include #include #include using namespace std;double H,h,D;double cal(double x){ return x+(h-x/D*H)*D/(D-x);}int mai...
分类:
其他好文 时间:
2015-02-05 23:02:42
阅读次数:
336
In a highly modernized fishing village, inhabitants there make a living on fishery. Their major tools, fishing nets, are produced and fixed by compute...
分类:
Web程序 时间:
2015-02-05 20:16:52
阅读次数:
335