http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1627 http://acm.fzu.edu.cn/problem.php?pid=2238 对应的51NOD这个题,先把n--和没m-- 再套公式 #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <algorit…
Daxia在2016年5月期间去瑞士度蜜月,顺便拜访了Wzc,Wzc给他出了一个问题: Wzc给Daxia等差数列A(0),告诉Daxia首项a和公差d; 首先让Daxia求出数列A(0)前n项和,得到新数列A(1); 然后让Daxia求出数列A(1)前n项和,得到新数列A(2); 接着让Daxia求出数列A(2)前n项和,得到新数列A(3); 规律题,首先写出 a.a+d.a+2d.a+3d...这个容易写出 下面一行也容易写出:a.2a+d.3a+3d.... 再下一行,确实难写,但是通过上…
题目链接: http://acm.fzu.edu.cn/problem.php?pid=2238 题目大意: 已知等差数列A(0)的首项a和公差d,求出数列A(0)前n项和,得到新数列A(1);以此类推,最终求A(m)的第i项mod1000000007 题目思路: [动态规划] 不难推出c[i][j]=c[i-1][j]+c[i][j-1] 但是i太大不能直接递推,m<=1000不能矩阵快速幂. 通过推导可以求出c[i][j]=a*C(n+m-1,n-1)+d*C(n+m-1,n-2) 求模时除…
公式. $a×C_{m + i - 1}^m + d×C_{m + i - 1}^{m + 1}$. 推导过程可以看http://blog.csdn.net/queuelovestack/article/details/52260127 #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cstring> #include<cmath> #…
Problem A Daxia & Wzc's problem Accept: 42    Submit: 228Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description Daxia在2016年5月期间去瑞士度蜜月,顺便拜访了Wzc,Wzc给他出了一个问题: Wzc给Daxia等差数列A(0),告诉Daxia首项a和公差d; 首先让Daxia求出数列A(0)前n项和,得到新数列A(1); 然后让Daxia求出数列A…
Problem A: The 3n + 1 problem Time Limit: 1 Sec  Memory Limit: 64 MBSubmit: 14  Solved: 6[Submit][Status][Web Board] Description Consider the following algorithm to generate a sequence of numbers. Start with an integer n. If n is even, divide by 2. I…
题目链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1627 1627 瞬间移动  基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题  收藏  关注 有一个无限大的矩形,初始时你在左上角(即第一行第一列),每次你都可以选择一个右下方格子,并瞬移过去(如从下图中的红色格子能直接瞬移到蓝色格子),求到第n行第m列的格子有几种方案,答案对1000000007取模. Input 单组测试数…
1627 瞬间移动  基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题  收藏  关注 有一个无限大的矩形,初始时你在左上角(即第一行第一列),每次你都可以选择一个右下方格子,并瞬移过去(如从下图中的红色格子能直接瞬移到蓝色格子),求到第n行第m列的格子有几种方案,答案对1000000007取模. Input 单组测试数据. 两个整数n,m(2<=n,m<=100000) Output 一个整数表示答案. Input示例 4 5 Output示例 10 #in…
博弈,$SG$函数,规律,线段树. 这个问题套路很明显,先找求出$SG$函数值是多少,然后异或起来,如果是$0$就后手赢,否则先手赢.修改操作和区间查询的话可以用线段树维护一下区间异或和. 数据那么大,一看就知道$SG$有规律...... 先写个小数据的$SG$找规律: ]; ]; int SG(int x) { memset(f,,sizeof f); ;i>=x/;i--) { if(x-i>i) break; f[sg[i]]=; } ;i<=;i++) { ) continue;…
模拟题,注意: 1.那两个贷款都是向银行贷的,就是两个贷款的总额不能超过70%,就算公积金贷款能贷也不行,我开始的时候以为公积金贷款是向公司借的,,欺负我这些小白嘛.... 2.最坑的地方 *0.7是wa的,要*7/10 3.那个公式的-1不是减在月份上的,是减在总体上的 #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <algorith…
// The 3n+1 problem (3n+1 问题) // PC/UVa IDs: 110101/100, Popularity: A, Success rate: low Level: 1 // Verdict: Accepted // Submission Date: 2011-05-22 // UVa Run Time: 0.032s // // 版权所有(C)2011,邱秋.metaphysis # yeah dot net. // // [问题描述] // 考虑如下的序列生成算法…
abstract: V const & a 加速 F. Mirror 题意 链接 问题: 有n个人在y=0的平面上(及xoz平面).z=0平面上有一面镜子(边平行于坐标轴).z=a平面上有q个点(保证a大于所有人的z坐标). 所有人面朝镜子,且在镜子和q个点之间(即每个人的z坐标保证0<z<a). 问对于某个点,让所有人能够通过镜子看到那个点的镜子的最小面积. 题解 三维几何+镜像+凸包 首先考虑镜面,我们可以通过(初中科学的)镜面反射原理,关于z=0做出z=a的对称平面z=-a.问题…
//we have defined the necessary header files here for this problem. //If additional header files are needed in your program, please import here. #include <stdio.h> #include <string.h> #define LENGHT 1000 void sumPlus(char *a, char *b); void re…
放了一个长长的暑假,可能是这辈子最后一个这么长的暑假了吧,呵呵...今天来实验室了,先找了zoj上面简单的题目练练手直接贴代码了,不解释,就是一道简单的密文转换问题: #include <stdio.h> #include <string.h> int main() { char cText[1000]; char start[10]; char end[5]; while(scanf("%s",start)!=EOF&&strcmp(start…
ZOJ ACM题集,编译环境VC6.0 #include <stdio.h> int main() { int a,b; while(scanf("%d%d",&a,&b)!=EOF) { printf("%d\n",a+b); } ; }…
参考:https://blog.csdn.net/metaphysis/article/details/6431937 #include <iostream> #include <cstdio> #include <cstring> using namespace std; typedef long long ll; ll a,b; ll length(ll x) { ll l=; ) { ==) { x=*x+; } else { x=x/; } l++; } ret…
传送门 解题思路 因为每次横纵坐标至少\(+1\),所以可以枚举走的步数,枚举走的步数\(i\)后剩下的就是把\(n-1\)与\(m-1\)划分成\(i\)个有序正整数相加,所以用隔板法,\(ans=\sum\limits_{i=1}^{min(n,m)-1} C(n-2,i-1)*C(m-2,i-1)\) 代码 #include<iostream> #include<cstdio> #include<cstring> #include<cmath> #in…
OpenCASCADE6.8.0 Reference Manual Serach Problem eryar@163.com 1. Problem 有网友反映OpenCASCADE6.8.0的Reference Manual的搜索功能不好用,以前没注意,自己试了下,的确在本机上不能正确搜索出给出的关键字相关的内容.如下图所示,在搜索框中输入gp_Pnt: Figure 1. Search class gp_Pnt 结果没有出来想要的内容,如下图所示: Figure 2. Search Resul…
选自<Reinforcement Learning: An Introduction>, version 2, 2016, Chapter2 https://webdocs.cs.ualberta.ca/~sutton/book/bookdraft2016sep.pdf 引言中是这样引出Chapter2的: One of the challenges that arise in reinforcement learning, and not in other kinds of learning…
原题链接 Problem Description You are a "Problem Killer", you want to solve many problems. Now you have n problems, the i-th problem's difficulty is represented by an integer ai (1≤ai≤109).For some strange reason, you must choose some integer l and r…
题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=4971 Description There's a company with several projects to be done. Finish a project will get you profits. However, there are some technical problems for some specific projects. To solve the proble…
GNG1106 Lab 3The Monty Hall ProblemBackgroundThe Monty Hall Problem is a famous probability puzzle, based on an old television show, in which the host,Monty Hall, plays a game with a player. It goes like this: In each game, three doors are presented…
Home Web Board ProblemSet Standing Status Statistics   Problem F: 求平均年龄 Problem F: 求平均年龄 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 720  Solved: 394[Submit][Status][Web Board] Description 定义一个Persons类,用于保存若干个人的姓名(string类型)和年龄(int类型),定义其方法 void ad…
题目来源:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3&page=show_problem&problem=36  The 3n + 1 problem  Background Problems in Computer Science are often classified as belonging to a certain class of problem…
[codeforces 528]B. Clique Problem 试题描述 The clique problem is one of the most well-known NP-complete problems. Under some simplification it can be formulated as follows. Consider an undirected graph G. It is required to find a subset of vertices C of…
Eddy's mistakes[HDU1161] Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6014    Accepted Submission(s): 3405 Problem DescriptionEddy usually writes articles ,but he likes mixing the English let…
https://en.wikipedia.org/wiki/Subset_sum_problem In computer science, the subset sum problem is an important problem in complexity theory and cryptography. The problem is this: given a set (or multiset) of integers, is there a non-empty subset whose…
Bag Problem Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/131072 K (Java/Others) Total Submission(s): 1449 Accepted Submission(s): 405 Problem Description 0/1 bag problem should sound familiar to everybody. Every earth man knows it well…
题目描述 组合数C(n,m)表示的是从n个物品中选出m个物品的方案数.举个例子,从(1,2,3) 三个物品中选择两个物品可以有(1,2),(1,3),(2,3)这三种选择方法.根据组合数的定 义,我们可以给出计算组合数的一般公式: C(n,m)=n!/m!(n-m)! 其中n! = 1 × 2 × · · · × n 小葱想知道如果给定n,m和k,对于所有的0 <= i <= n,0 <= j <= min(i,m)有多少对 (i,j)满足C(i,j)是k的倍数. 输入输出格式 输…
Problem JThe Closest Pair ProblemInput: standard inputOutput: standard outputTime Limit: 8 secondsMemory Limit: 32 MB Given a set of points in a two dimensional space, you will have to find the distance between the closest two points. Input The input…