![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数学知识
文章平均质量分 71
老鼠哎大米
这个作者很懒,什么都没留下…
展开
-
输入n值,使用递归函数,求杨辉三角形中各个位置上的值,打印输出图形。
输入n值,使用递归函数,求杨辉三角形中各个位置上的值,打印输出图形。前提:每行端点与结尾的数为1.每个数等于它上方两数之和。每行数字左右对称,由1开始逐渐变大。第n行的数字有n项。第n行数字和为2n-1。第n行的m个数可表示为 C(n-1,m-1),即为从n-1个不同元素中取m-1个元素的组合数。第n行的第m个原创 2017-02-27 13:25:45 · 4978 阅读 · 0 评论 -
ZOJ 3600 Taxi Fare
DescriptionLast September, Hangzhou raised the taxi fares.The original flag-down fare in Hangzhou was 10 yuan, plusing 2 yuan per kilometer after the first 3km and 3 yuan per kilometer after 10k原创 2014-04-30 21:02:27 · 719 阅读 · 0 评论 -
ZOJ 3708 Density of Power Network
DescriptionThe vast power system is the most complicated man-made system and the greatest engineering innovation in the 20th century. The following diagram shows a typical 14 bus power system. In原创 2014-04-30 20:45:38 · 535 阅读 · 0 评论 -
ZOJ 3782 Ternary Calculation
DescriptionComplete the ternary calculation.InputThere are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:原创 2014-04-30 20:25:33 · 570 阅读 · 0 评论 -
ZOJ 3778 Talented Chef
DescriptionAs we all know, Coach Gao is a talented chef, because he is able to cook M dishes in the same time. Tonight he is going to have a hearty dinner with his girlfriend at his home. Of cours原创 2014-04-30 20:23:12 · 563 阅读 · 0 评论 -
CF3A. Shortest path of the king
The king is left alone on the chessboard. In spite of this loneliness, he doesn't lose heart, because he has business of national importance. For example, he has to pay an official visit to square t.原创 2014-03-29 11:58:42 · 734 阅读 · 0 评论 -
CodeForces 339A Helpful Maths
DescriptionXenia the beginner mathematician is a third year student at elementary school. She is now learning the addition operation.The teacher has written down the sum of multiple numbers. Pup原创 2014-03-30 19:45:18 · 800 阅读 · 0 评论 -
CodeForces 352A Jeff and Digits
DescriptionJeff's got n cards, each card contains either digit 0, or digit 5. Jeff can choose several cards and put them in a line so that he gets some number. What is the largest possible number原创 2014-03-30 19:40:11 · 659 阅读 · 0 评论 -
HDU 2601 An easy problem
Problem DescriptionWhen Teddy was a child , he was always thinking about some simple math problems ,such as “What it’s 1 cup of water plus 1 pile of dough ..” , “100 yuan buy 100 pig” .etc..On原创 2013-08-06 14:08:09 · 605 阅读 · 0 评论 -
CF4A. Watermelon
One hot summer day Pete and his friend Billy decided to buy a watermelon. They chose the biggest and the ripest one, in their opinion. After that the watermelon was weighed, and the scales showed w ki原创 2014-03-29 12:05:23 · 533 阅读 · 0 评论 -
CF 9C. Hexadecimal's Numbers
One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got access to the memory of his not less mean sister Hexadecimal. He loaded there a huge amount of n di原创 2014-03-27 22:06:46 · 965 阅读 · 0 评论 -
ZOJ 3609 Modular Inverse
DescriptionThe modular modular multiplicative inverse of an integer a modulo m is an integer x such that a-1≡x (mod m). This is equivalent toax≡1 (mod m).InputThere are multiple test原创 2014-04-30 21:36:03 · 563 阅读 · 0 评论 -
CodeForces 402A Nuts
DescriptionYou have a nuts and lots of boxes. The boxes have a wonderful feature: if you put x(x ≥ 0) divisors (the spacial bars that can divide a box) to it, you get a box, divided into x + 1 s原创 2014-03-31 14:09:02 · 624 阅读 · 0 评论 -
ZOJ 1850 Beautiful Meadow
Tom's MeadowTom has a meadow in his garden. He divides it into N * M squares. Initially all the squares were covered with grass. He mowed down the grass on some of the squares and thinks the mea原创 2014-03-23 21:01:47 · 528 阅读 · 0 评论 -
编写一个求菲波那奇数列的递归函数,输入n值,使用该递归函数,输出图形。
编写一个求斐波那契数列的递归函数,输入n值,使用该递归函数,输出如下图形。P.S:借鉴的别人的代码。。。。。实在是想不出来了,把图形从中间分成两部分,依次根据斐波那契数列的公式输入。但是斐波那契数列与本题不完全相同。斐波那契数列:F(0)=1;F(1)=1;F(n)=F(n-1)+F(n-2);(n>=2)但是本题依图形来看应是:F(0)=0;F(1)=原创 2017-02-27 11:01:53 · 3273 阅读 · 0 评论 -
一个多项式a+b*x+c*x^2+d*x^3+...,输入该多项式的系数和x的值后打印出这个多项式的值。
实现一个多项式a+b*x+c*x^2+d*x^3+...,要求输入该多项式的系数和x的值后打印出这个多项式的值。(实际上就是递归)。n=0时:num[0]n=1时:num[0]+num[1]*x;n=2时:num[0]+(num[1]+num[2]*x)*x;#include using namespace std;int temp,n,x;int num[1原创 2017-02-26 17:24:16 · 2332 阅读 · 0 评论 -
计算角度的正弦值
正弦函数的求解公式#define PI 3.14159265#include #include //#include using namespace std;//阶乘long mul(int n){ //assert(n>0); if(n==1)return 1; long value=1; for(int i=1;i<=n;++i) value *= i; re原创 2017-02-26 15:06:34 · 6470 阅读 · 1 评论 -
写一个类,能接受int型的变量,接收变量后能存储原变量和其反向变量,最多处理数量为10个,当输入达到10个或者输入变量为0的时候停止。
写一个类,能接受int型的变量,接收变量后能存储原变量(如12345)和其反向变量(54321),最多处理数量为10个,当输入达到10个或者输入变量为0的时候停止。#include #include using namespace std;class Int{ int num;public: Int(int n):num(n){} int reverse(); int get原创 2017-02-26 07:38:20 · 602 阅读 · 0 评论 -
输入三个点的坐标,实现判断此三角形是不是直角三角形,并输出此三角形的周长。
输入三个点的坐标,实现判断此三角形是不是直角三角形,并输出此三角形的周长。#include#include//#includeusing namespace std;class CPoint{ double x,y;public: CPoint(double xx,double yy){x=xx;y=yy;} double operator- (CPoint c);};d原创 2017-02-24 23:02:26 · 7370 阅读 · 0 评论 -
创建一个CPoint类,代表平面直角坐标系中的点,创建构造函数和运算符重载函数, 运算符重载为类重载(非友元重载),可以实现计算两个点之间的距离。可以根据需要 加入自己的成员变量或成员函数
创建一个CPoint类,代表平面直角坐标系中的点,创建构造函数和运算符重载函数,运算符重载为类重载(非友元重载),可以实现计算两个点之间的距离。可以根据需要加入自己的成员变量或成员函数.#include#include//#includeusing namespace std;class CPoint{ double x,y;public: CPoint(double xx原创 2017-02-24 22:28:16 · 3953 阅读 · 1 评论 -
一个小球,从高为H的地方下落,下落弹地之后弹起高度为下落时的一半, 比如第一次弹起高度为H/2,如此往复,计算从小球H高度下落到第n次弹地 往返的总路程。
一个小球,从高为H的地方下落,下落弹地之后弹起高度为下落时的一半,比如第一次弹起高度为H/2,如此往复,计算从小球H高度下落到第n次弹地往返的总路程。#include#includeusing namespace std;double fun(int n){ if(n==1) return 1; else return fun(n-1)+1/pow(2,n-2);}in原创 2017-02-24 22:12:34 · 10145 阅读 · 0 评论 -
hdu 1229&&九度oj1015 还是A+B
题目描述:读入两个小于10000的正整数A和B,计算A+B。需要注意的是:如果A和B的末尾K(不超过8)位数字相同,请直接输出-1。输入:测试输入包含若干测试用例,每个测试用例占一行,格式为"A B K",相邻两数字有一个空格间隔。当A和B同时为0时输入结束,相应的结果不要输出。输出:对每个测试用例输出1行,即A+B的值或者是-1。样例输入:原创 2017-03-03 11:02:51 · 491 阅读 · 0 评论 -
设N是一个四位数,它的 9 倍恰好是其反序数,求N的值。
设N是一个四位数,它的 9 倍恰好是其反序数(例如:1234的反序数是4321),求N的值。参考简单代码:将四位数分别用4个整数表示:#includeusing namespace std;int main(){ for(int i=1000;i<=9999;i++) { int a,b,c,d; a=i/1000; b=i/100-a*10; c=(i/10原创 2017-02-27 19:05:54 · 14645 阅读 · 4 评论 -
CF 6A——比赛 I - Triangle
Johnny has a younger sister Anne, who is very clever and smart. As she came home from the kindergarten, she told his brother about the task that her kindergartener asked her to solve. The task was jus原创 2014-03-26 18:04:57 · 658 阅读 · 0 评论 -
CF 7A——比赛A Kalevitch and Chess
A famous Berland's painter Kalevitch likes to shock the public. One of his last obsessions is chess. For more than a thousand years people have been playing this old game on uninteresting, monotonous原创 2014-03-27 21:52:36 · 987 阅读 · 0 评论 -
比赛 I - 0 or 1
DescriptionSolving problem is a interesting thing. Yifenfei like to slove different problem,because he think it is a way let him more intelligent. But as we know,yifenfei is weak in math. When he原创 2014-03-17 12:23:51 · 627 阅读 · 0 评论 -
CF 9A. Die Roll
Yakko, Wakko and Dot, world-famous animaniacs, decided to rest from acting in cartoons, and take a leave to travel a bit. Yakko dreamt to go to Pennsylvania, his Motherland and the Motherland of his a原创 2014-03-27 21:55:09 · 870 阅读 · 0 评论 -
HDU 1108 最小公倍数
Problem Description给定两个正整数,计算这两个数的最小公倍数。Input输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数.Output对于每个测试用例,给出这两个数的最小公倍数,每个实例输出一行。Sample Input10 14Sample Output70#include原创 2013-08-19 09:17:47 · 502 阅读 · 0 评论 -
Platforms
点击打开链接:http://codeforces.com/problemset/problem/18/BIn one one-dimensional world there are n platforms. Platform with index k (platforms are numbered from 1) is a segment with coordi原创 2014-02-21 09:53:45 · 871 阅读 · 0 评论 -
HDU Quick Change
Problem DescriptionJ.P. Flathead’s Grocery Store hires cheap labor to man the checkout stations. The people he hires (usually high school kids) often make mistakes making change for the customers.原创 2013-08-11 08:41:53 · 894 阅读 · 0 评论 -
hdu 1012 u Calculate e
Problem DescriptionA simple mathematical formula for e iswhere n is allowed to go to infinity. This can actually yield very accurate approximations of e using relatively small values of n.原创 2014-02-08 18:47:25 · 519 阅读 · 0 评论 -
hdu 1014 Uniform Generator
Problem DescriptionComputer simulations often require random numbers. One way to generate pseudo-random numbers is via a function of the formseed(x+1) = [seed(x) + STEP] % MODwhere '%' is原创 2014-02-08 19:38:14 · 497 阅读 · 0 评论 -
You are my brother
DescriptionLittle A gets to know a new friend, Little B, recently. One day, they realize that they are family 500 years ago. Now, Little A wants to know whether Little B is his elder, younger原创 2014-02-15 16:46:56 · 808 阅读 · 0 评论 -
NYoj 水仙花数
描述请判断一个数是不是水仙花数。其中水仙花数定义各个位数立方和等于它本身的三位数。输入有多组测试数据,每组测试数据以包含一个整数n(100输入0表示程序输入结束。输出如果n是水仙花数就输出Yes否则输出No样例输入1531540样例输出YesNo#include using namespace std;int m原创 2013-08-10 00:13:56 · 1131 阅读 · 0 评论 -
周赛题目 福州 数字的孔数
DescriptionS得到一个数,他想知道这个数每一位上的数字的孔数之和。1,2,3,5,7这几个数字是没有孔的,0,4,6,9都有一个孔,8有两个孔。Input输入数据的第一行为一个数T表示数据组数。接下来T行,每行输入一个正整数n(1Output对于每组数据输出一行一个整数,表示该数的每一位上的数字的孔数之和。Sample Input2原创 2013-10-28 20:29:11 · 713 阅读 · 0 评论 -
uva 414 Machined Surfaces
An imaging device furnishes digital images of two machined surfaces that eventually will be assembled in contact with each other. The roughness of this final contact is to be estimated.A digital i原创 2014-01-23 09:18:14 · 674 阅读 · 0 评论 -
Theatre Square
Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square grani原创 2014-02-19 11:02:55 · 723 阅读 · 0 评论 -
组合数
输入非负整数n和m,输出组合数C=n!/m!(n-m)!,其中m输入:20 1输出:20#include using namespace std;int main(){ int m,n; while(cin>>n>>m) { float s=1; for(int i=1;i<=m;i++) {原创 2013-08-12 18:00:10 · 513 阅读 · 0 评论 -
Three matrices
点击打开链接 http://codeforces.com/contest/393/problem/BChubby Yang is studying linear equations right now. He came up with a nice problem. In the problem you are given an n × n matrix W, consisti原创 2014-02-20 15:56:37 · 601 阅读 · 0 评论 -
hdu 2603 && 比赛 D - Wiskey's Power
Problem DescriptionCome back school from the 33rdACM / ICPC Asia ChenDu, everyone is exhausted, in particular the captain Wiskey. As saying that night, Wiskey drink a lot of wine, just as he blurr原创 2014-03-17 13:32:46 · 718 阅读 · 0 评论