从HD OJ 1005想到的】的更多相关文章

杭电OJ [1005](http://acm.hdu.edu.cn/showproblem.php?pid=1005): #####Problem Description > A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7. Given A, B, and n, you are to calculate the value of f(n)…
http://www.lightoj.com/volume_showproblem.php?problem=1005        PDF (English) Statistics Forum Time Limit: 1 second(s) Memory Limit: 32 MB A rook is a piece used in the game of chess which is played on a board of square grids. A rook can only move…
题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1005 纸上画一下,找了一下规律,Ank*Cnk. //#pragma comment(linker, "/STACK:102400000, 102400000") #include <algorithm> #include <iostream> #include <cstdlib> #include <cstring>…
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:5646 解决:1632 题目描述: It is said that in 2011, there are about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if you could write a program to automate the admission p…
题目1005:Graduate Admission 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6182 解决:1791 题目描述:                        It is said that in 2011, there are about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if you…
题目链接:http://bailian.openjudge.cn/practice/1005/ 思路 一个半圆面积每年增长50,已知一个点坐标,求第几年点在半圆内. #include <stdio.h> #include <math.h> #define pai 3.1415926 int main() { int n; double x,y; scanf("%d",&n); for(int i=0;i<n;i++) { scanf("%…
题目大意: 给你一个N和K要求确定有多少种放法,使得没有两个车在一条线上. N*N的矩阵, 有K个棋子. 题目分析: 我是用DP来写的,关于子结构的考虑是这样的. 假设第n*n的矩阵放k个棋子那么,这个推导过程如下.   当我们们第n*n的矩阵的时候可以考虑第(n-1)*(n-1)的矩阵经过哪些变换可以变成n*n的. 如上图蓝色方格.我们加入蓝色方格之后,矩阵就会增大一圈. 1.加入我们蓝色方格不放置棋子. dp[n-1][k] 2.加入蓝色方格放置一枚棋子,那么我们其实有三种位置可以放置:(1…
题意: 从 n*n 的棋盘中放置 K 个 行和列不冲突的棋子 思路: 组合数学, 先选 k 个 行, k 个列, 就是 C(n,k) ^ 2; 然后 K 个棋子不相同, K ! 全排列 #include<bits/stdc++.h> using namespace std; typedef long long LL; LL Num[40][40]; void Init() { Num[0][0] = 1; for(int i = 1; i <= 30; ++i) { Num[i][0]…
版权声明:本文作者靖心.靖空间地址:http://blog.csdn.net/kenden23/,未经本作者同意不得转载. https://blog.csdn.net/kenden23/article/details/31760795 A rook is a piece used in the game of chess which is played on a board of square grids. A rook can only move vertically or horizonta…
sky同学在努力地刷题..,在这题卡住了,于是一起研究了一下... 这题本身挺简单的,(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7. 递推公式本身是mod7的...所以f(n-1)和f(n-2)最多只有49种状态,根据鸽巢原理在50以内必定循环. 只要推导出周期和循环的起始位置就行了.一开始只算了周期,没考虑从哪里开始循环,但竟然神奇地AC了...后来想了想觉得不对,应该加入循环的起始位置. 经过手动验证 7 7 49…