自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(54)
  • 问答 (2)
  • 收藏
  • 关注

转载 ZOJ 1003

judge函数是怎么执行的?求问/*函数不是很懂??????*/#include<iostream>#include<stdio.h>#include<algorithm>using namespace std;bool atrue, btrue;int judge(int m, int n, int p){ if (atrue) return 0; if (

2017-10-31 11:10:00 313

原创 ZOJ 1078

/*判断回文数:1,进制分解:用模运算和整除运算即可,每一位存在数组c2,回文判断:将c中按长度len对折,判断对应的位是否相同,有一个不同,就不是回文数*/#include<iostream>#include<stdio.h>using namespace std;int main(){ int n; while (cin >> n&&n) { c

2017-10-29 22:32:07 248

原创 ZOJ 1058

当伊萨克从一个国家c[i-1]去另一个国家c[i]旅行(i=1和i=n+2是美国,则旅行的国家是i=2~n+1),货币汇率是a[c[i-1]][c[i]],四舍五入即可。#include<iostream>#include<iomanip>using namespace std;int main(){ int n; //旅行国家数 double m; doubl

2017-10-29 12:49:38 299

原创 扩展欧几里得算法(POJ 1061)

分析可知,该题只需求解同余方程(x+am)(x+am)%L=(y+an)L=(y+an)%LL最小的a即可。 对方程变形可得 a∗(m−n)+k∗L=y−xa*(m-n)+k*L=y-x , k为一整数 令p=m−n,q=y−xp=m-n,q=y-x,有:a∗p+k∗L=qa*p+k*L=q (1) (1)式即为扩展欧

2017-10-17 12:26:49 216

原创 1799 Yeehaa!

DescriptionBackground George B. wants to be more than just a good American. He wants to make his daddy proud and become a western hero. You know, like John Wayne. But sneaky as he is, he wants a sp

2017-09-10 13:09:56 311

原创 1299 Polar Explorer

DescriptionYou are a intrepid 2-dimensional explorer located at the northern polar reaches of a distant 2-dimensional planet. Unfortunately, you have been assigned to explore the most boring planet in

2017-09-04 20:46:22 525

原创 1183 反正切函数的应用

Description反正切函数可展开成无穷级数,有如下公式 (其中0 <= x <= 1) 公式(1) 使用反正切函数计算PI是一种常用的方法。例如,最简单的计算PI的方法: PI=4arctan(1)=4(1-1/3+1/5-1/7+1/9-1/11+…) 公式(2) 然而,这种方法的效率很低,但我们可以根据角度和的正切函数公式: tan(a+b)=[tan(a)+

2017-09-03 23:40:42 528

原创 2291 Rotten Ropes

DescriptionSuppose we have n ropes of equal length and we want to use them to lift some heavy object. A tear-off weight t is associated to each rope, that is, if we try to lift an object, heavier than

2017-08-26 14:54:36 232

原创 2242 The Circumference of the Circle

DescriptionTo calculate the circumference of a circle seems to be an easy task - provided you know its diameter. But what if you don’t?You are given the cartesian coordinates of three non-collinear poi

2017-08-26 10:40:42 211

原创 2365 Rope

DescriptionPlotters have barberically hammered N nails into an innocent plane shape, so that one can see now only heads. Moreover, pursuing their mean object, they have hammered all the nails into the

2017-08-25 19:31:38 235

原创 2363 Blocks

/*将正方体拼成表面积最小的长方体*//*利用体积不变,暴力枚举。*/#include<iostream>#include<algorithm>using namespace std;int main(){ int C; cin >> C; while (C--) { int N; int cnt = 0; ci

2017-08-25 16:58:41 175

原创 1410 Intersection

DescriptionYou are to write a program that has to decide whether a given line segment intersects a given rectangle. An example: line: start point: (4,9) end point: (11,2) rectangle: left-top: (1,

2017-08-24 14:38:37 165

原创 1401 Factorial

DescriptionThe most important part of a GSM network is so called Base Transceiver Station (BTS). These transceivers form the areas called cells (this term gave the name to the cellular phone) and every

2017-08-23 20:45:14 198

原创 1269 Intersecting Lines

DescriptionWe all know that a pair of distinct points on a plane defines a line and that a pair of lines on a plane will intersect in one of three ways: 1) no intersection because they are parallel, 2)

2017-08-22 19:22:05 157

原创 1003 Hangover

DescriptionHow far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We’re assuming that the cards must be perpendicular to

2017-08-22 17:35:17 189

原创 1254 Hansel and Grethel

DescriptionOn a warm summer afternoon, Hansel and Grethel are walking together in the fields. It is getting late and, to be honest, they are lost. Grethel is a little scared, still vividly remembering

2017-08-22 17:20:43 307

原创 1045. Bode Plot

题目链接: http://poj.org/problem?id=1045思路: v2=iR=CRd(v1−v2)/dtv_2=iR=CRd(v_1-v_2)/dt dv1/dt=−wVssin(wt)dv_1/dt=-wV_ssin(wt) dv2/dt=−WVRsin(wt+θ)dv_2/dt=-WV_Rsin(wt+\theta) 所以有:v2=CRw(VRsin(wt+θ)−Vssi

2017-08-21 10:19:52 314

原创 1249. 三角形

题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1249思路: 两个三角形相交时,如图: 新增部分与增加的交点数相同。 在画第n个三角形时,每条边最多与之前的n-1个三角形的各两条边相交,可以产生3*(2*(n-1))=6(n-1)个交点,即增加6(n-1)部分。所以n个三角形最多把平面分为2+6*(1+2+…+(n-1))=2+3n(n-1)

2017-08-20 13:25:53 193

原创 1568.Fibonacci

题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1568思路 参考了大神的对数解法: http://www.cnblogs.com/Yu2012/archive/2011/10/09/2199156.html 代码:#include<iostream>#include<math.h>using namespace std;int Fib(int

2017-08-17 18:01:07 151

原创 科学计数法

科学计数法是科学家用来表示很大或很小的数字的一种方便的方法,其满足正则表达式[+-][1-9]”.”[0-9]+E[+-][0-9]+,即数字的整数部分只有1位,小数部分至少有1位,该数字及其指数部分的正负号即使对正数也必定明确给出。 现以科学计数法的格式给出实数A,请编写程序按普通数字表示法输出A,并保证所有有效位都被保留。输入格式: 每个输入包含1个测试用例,即一个以科学计数法表示的实数A

2017-07-30 22:36:46 531

原创 组个最小数

给定数字0-9各若干个。你可以以任意顺序排列这些数字,但必须全部使用。目标是使得最后得到的数尽可能小(注意0不能做首位)。例如:给定两个0,两个1,三个5,一个8,我们得到的最小的数就是10015558。 现给定数字,请编写程序输出能够组成的最小的数。输入格式: 每个输入包含1个测试用例。每个测试用例在一行中给出10个非负整数,顺序表示我们拥有数字0、数字1、……数字9的个数。整数间用一个空

2017-07-30 17:44:03 290

原创 D进制的A+B

输入两个非负10进制整数A和B(<=230−12^{30}-1),输出A+B的D (1 < D <= 10)进制数。 输入格式: 输入在一行中依次给出3个整数A、B和D。 输出格式: 输出A+B的D进制数。 输入样例: 123 456 8 输出样例: 1103代码#include<string.h>using namespace std;int main(){ in

2017-07-29 09:57:49 292 1

原创 个位数统计

给定一个k位整数N = dk−1∗10k−1+...+d1∗101+d0(0<=di<=9,i=0,...,k−1,dk−1>0)d_{k-1}*10^{k-1} + ... + d_1*10^1 + d_0 (0<=d_i<=9, i=0,...,k-1, d_{k-1}>0),请编写程序统计每种不同的个位数字出现的次数。例如:给定N = 100311,则有2个0,3个1,和1个3。 输入格式:

2017-07-29 09:28:25 1840

原创 月饼

月饼是中国人在中秋佳节时吃的一种传统食品,不同地区有许多不同风味的月饼。现给定所有种类月饼的库存量、总售价、以及市场的最大需求量,请你计算可以获得的最大收益是多少。 注意:销售时允许取出一部分库存。样例给出的情形是这样的:假如我们有3种月饼,其库存量分别为18、15、10万吨,总售价分别为75、72、45亿元。如果市场的最大需求量只有20万吨,那么我们最大收益策略应该是卖出全部15万吨第2种月饼

2017-07-28 21:17:09 252

原创 3252. Round Numbers

DescriptionThe cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, Paper, Stone’ (also known as ‘Rock, Paper, Scissors’, ‘Ro, Sham, Bo’, and a host of other names) in ord

2017-07-27 18:38:07 145

原创 1019. Number Sequence

DescriptionA single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2…Sk. Each group Sk consists of a sequence of positive i

2017-07-27 17:37:30 229

原创 数字黑洞

DescriptionA single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2…Sk. Each group Sk consists of a sequence of positive i

2017-07-24 23:30:49 334

原创 3094. Quicksum

DescriptionA checksum is an algorithm that scans a packet of data and returns a single number. The idea is that if the packet is changed, the checksum will also change, so checksums are often used for

2017-07-22 12:59:31 219

原创 3006. Dirichlet's Theorem on Arithmetic Progressions

DescriptionIf a and d are relatively prime positive integers, the arithmetic sequence beginning with a and increasing by d, i.e., a, a + d, a + 2d, a + 3d, a + 4d, …, contains infinitely many prime num

2017-07-22 09:53:23 204

原创 1503. Integer Inquiry

DescriptionOne of the first users of BIT’s new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various sums of those numbers. This

2017-07-21 18:28:40 216

原创 2262. Goldbach's Conjecture

DescriptionIn 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which he made the following conjecture: Every even number greater than 4 can be written as

2017-07-18 18:39:49 257

原创 1083. Moving Tables

DescriptionThe famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor has 200 rooms each on the north side and south side alon

2017-07-18 12:20:09 165

原创 2739. Sum of Consecutive Prime Numbers

DescriptionSome positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representations does a given positive integer have? For example, the integer 53 has

2017-07-18 09:44:37 193

原创 A除以B

本题要求计算A/B,其中A是不超过1000位的正整数,B是1位正整数。你需要输出商数Q和余数R,使得A = B * Q + R成立。输入格式: 输入在1行中依次给出A和B,中间以1空格分隔。 输出格式: 在1行中依次输出Q和R,中间以1空格分隔。 输入样例: 123456789050987654321 7 输出样例: 17636684150141093474 3代码#include

2017-07-18 09:32:53 361

原创 2159. Ancient Cipher

这道题误导性较强:一般我们会从original message出发,先进行substitution cipher,再permutation cipher。问题的关键在于:对于实际中的密文,我们很难找出permutation cipher的加密序列,所以很难破解。换一种思路:破解substitution cipher后,密文和所猜测的明文仅仅是调换了顺序而已。所以将密文和所猜测的明文都看做是随机序列,之后对其中的每

2017-07-17 09:15:00 197

原创 部分A+B

正整数A的“DAD_A(为1位整数)部分”定义为由A中所有DAD_A组成的新整数PAP_A。例如:给定A = 3862767,DAD_A= 6,则A的“6部分”PAP_A是66,因为A中有2个6。 现给定A、DAD_A、B、DBD_B,请编写程序计算PAP_A + PBP_B。输入格式: 输入在一行中依次给出A、DAD_A、B、DBD_B,中间以空格分隔,其中0 < A, B < 101010

2017-07-17 09:12:48 163

翻译 德才论

宋代史学家司马光在《资治通鉴》中有一段著名的“德才论”:“是故才德全尽谓之圣人,才德兼亡谓之愚人,德胜才谓之君子,才胜德谓之小人。凡取人之术,苟不得圣人,君子而与之,与其得小人,不若得愚人。” 现给出一批考生的德才分数,请根据司马光的理论给出录取排名。 输入格式: 输入第1行给出3个正整数,分别为:N(<=10510^5),即考生总数;L(>=60),为录取最低分数线,即德分和才分均不低于L

2017-07-17 09:07:01 201

原创 3299. Humidex

DescriptionAdapted from Wikipedia, the free encyclopediaThe humidex is a measurement used by Canadian meteorologists to reflect the combined effect of heat and humidity. It differs from the heat index

2017-07-17 09:00:30 341

原创 1000. A+B Problem

DescriptionCalculate a+bInput Two integer a,b (0<=a,b<=10) Output Output a+bSample Input 1 2 Sample Output 3代码#include<stdio.h>int main(){ int a,b; scanf("%d %d",&a,&b); printf("%d"

2017-07-16 18:48:40 190

原创 福尔摩斯的约会

大侦探福尔摩斯接到一张奇怪的字条:“我们约会吧! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm”。大侦探很快就明白了,字条上奇怪的乱码实际上就是约会的时间“星期四 14:04”,因为前面两字符串中第1对相同的大写英文字母(大小写有区分)是第4个字母’D’,代表星期四;第2对相同的字符是’E’,那是第5个英文字母,代表一天里的第14个钟头(

2017-07-16 15:48:49 160

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除