原题请戳这里 题意: 将杯子摆成杨辉三角状,即顶层1个杯子,第二层2个杯子,……第N层N个杯子。 每一秒能倒满1个杯子,每次一个杯子满了,酒会平分得流入它下面支撑它的两个杯子中。 如下图所示。1?≤?n?≤?10,?0?≤?t?≤?10?000。 分析:由于n很小,所以直接模拟此过程,其实也是一个递 ...
分类:
其他好文 时间:
2016-05-30 00:48:34
阅读次数:
261
程序地址:http://www.cheemoedu.com/exercise/4问题描述:根据输入行数,打印出杨辉三角,如图所示。111121133114641151010511615201561我的程序:deftriangle(x):
ln=[1]
ifx==1:
returnln
ifx==2:
returnln+[1]
n=0
whilen<(x-2):
s=triangle(x-1)[n]+triangle(x-1)[n+1]..
分类:
其他好文 时间:
2016-05-26 14:49:51
阅读次数:
139
规律是杨辉三角,也就是求排列组合。因为要取模,所以需要用到逆元。 ...
分类:
移动开发 时间:
2016-05-25 20:43:44
阅读次数:
204
网上发现了不错的博客讲解... 原博客链接:http://www.indestinee.com/combinationinit/ 组合数的预处理(费马小定理|杨辉三角|卢卡斯定理) 当y比较小,或者x-y比较小的时候,其中MAX为溢出判断,或者最大值,但要保证MAX * i 不溢出。 点击展开代码 ...
分类:
其他好文 时间:
2016-05-23 21:20:32
阅读次数:
150
1003.杨辉三角+逆元 #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <stack> #include <string> #include ...
分类:
其他好文 时间:
2016-05-23 00:49:57
阅读次数:
152
package lianxi; public class Yanghuisanjiao { public static void main(String[] args) { int[][] ary =new int[10][10]; for (int i = 0; i < 10; i++) { fo ...
分类:
其他好文 时间:
2016-05-20 21:06:47
阅读次数:
135
打印杨辉三角,打印行数由用户输入。 结果: ...
分类:
其他好文 时间:
2016-05-15 15:12:43
阅读次数:
141
/*
打印出杨辉三角形
输入:n
输出:n行 样例:如下图
输入:4
输出:
1
1 1
1 2 1
1 3 3 1 输入:6
输出:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1 问...
分类:
其他好文 时间:
2016-05-13 00:35:25
阅读次数:
164
求1,2,3,4组合成无重复且不同的三位数的Java源代码:http://www.manonggu.com/biancheng/259
杨辉三角的Java源代码:http://www.manonggu.com/biancheng/290
3数排序输出的Java源代码:http://www.manonggu.com/biancheng/289
交换输出元素的Java源代...
分类:
编程语言 时间:
2016-05-12 19:51:58
阅读次数:
137