- 博客(123)
- 收藏
- 关注
原创 Currency Exchange
题目:我们的城市有几个货币兑换点。让我们假设每一个点都只能兑换专门的两种货币。可以有几个点,专门从事相同货币兑换。每个点都有自己的汇率,外汇汇率的A到B是B的数量你1A。同时各交换点有一些佣金,你要为你的交换操作的总和。在来源货币中总是收取佣金。 例如,如果你想换100美元到俄罗斯卢布兑换点,那里的汇率是29.75,而佣金是0.39,你会得到(100 - 0.39)×29.75=2963.39...
2020-02-03 11:24:26
257
原创 Arbitrage
题目:Arbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US Dollar buys 0.5 B...
2020-02-03 11:17:50
131
原创 Cow Hurdles
题目:Farmer John wants the cows to prepare for the county jumping competition, so Bessie and the gang are practicing jumping over hurdles. They are getting tired, though, so they want to be able to us...
2020-02-03 10:43:45
210
原创 E-find the safest road
题目:XX星球有很多城市,每个城市之间有一条或多条飞行通道,但是并不是所有的路都是很安全的,每一条路有一个安全系数s,s是在 0 和 1 间的实数(包括0,1),一条从u 到 v 的通道P 的安全度为Safe(P) = s(e1)*s(e2)…*s(ek) e1,e2,ek是P 上的边 ,现在8600 想出去旅游,面对这这么多的路,他想找一条最安全的路。但是8600 的数学不好,想请你帮忙 ^...
2020-02-03 10:16:35
195
原创 Choose the best route
题目:One day , Kiki wants to visit one of her friends. As she is liable to carsickness , she wants to arrive at her friend’s home as soon as possible . Now give you a map of the city’s traffic route, ...
2020-02-03 09:44:23
185
原创 A strange lift
题目:There is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two buttons: up and down.When you at floor...
2020-02-02 21:58:36
218
原创 Dijkstra 畅通工程续
题目:某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。Input本题目包含多组数据,请处理到文件结束。每组数据第一行包含两个正整数N和M(0<N<200,0...
2020-02-02 21:18:06
188
原创 PAT1010 一元多项式求导
题目:设计函数求一元多项式的导数。(注:xn(n为整数)的一阶导数为nxn−1。)输入格式:以指数递降方式输入多项式非零项系数和指数(绝对值均为不超过 1000 的整数)。数字间以空格分隔。输出格式:以与输入相同的格式输出导数多项式非零项的系数和指数。数字间以空格分隔,但结尾不能有多余空格。注意“零多项式”的指数和系数都是 0,但是表示为0 0。输入样例:...
2020-02-01 23:04:39
155
原创 PAT1009 说反话
题目:给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出。输入格式:测试输入包含一个测试用例,在一行内给出总长度不超过 80 的字符串。字符串由若干单词和若干空格组成,其中单词是由英文字母(大小写有区分)组成的字符串,单词之间用 1 个空格分开,输入保证句子末尾没有多余的空格。输出格式:每个测试用例的输出占一行,输出倒序后的句子。输入样例:Hello Worl...
2020-02-01 23:03:37
103
原创 PAT1007 素数对猜想
题目:让我们定义dn为:dn=pn+1−pn,其中pi是第i个素数。显然有d1=1,且对于n>1有dn是偶数。“素数对猜想”认为“存在无穷多对相邻且差为2的素数”。现给定任意正整数N(<105),请计算不超过N的满足猜想的素数对的个数。输入格式:输入在一行给出正整数N。输出格式:在一行中输出不超过N的满足猜想的素数...
2020-02-01 23:01:17
221
原创 1006 换个格式输出整数
题目:让我们用字母B来表示“百”、字母S表示“十”,用12...n来表示不为零的个位数字n(<10),换个格式来输出任一个不超过 3 位的正整数。例如234应该被输出为BBSSS1234,因为它有 2 个“百”、3 个“十”、以及个位的 4。输入格式:每个测试输入包含 1 个测试用例,给出正整数n(<1000)。输出格式:每个测试用例的输出占一...
2020-02-01 23:00:06
426
原创 PAT1005 继续(3n+1)猜想
题目:卡拉兹(Callatz)猜想已经在1001中给出了描述。在这个题目里,情况稍微有些复杂。当我们验证卡拉兹猜想的时候,为了避免重复计算,可以记录下递推过程中遇到的每一个数。例如对n=3进行验证的时候,我们需要计算 3、5、8、4、2、1,则当我们对n=5、8、4、2 进行验证的时候,就可以直接判定卡拉兹猜想的真伪,而不需要重复计算,因为这 4 个数已经在验证3的时候遇到过了,我们...
2020-02-01 22:58:57
221
原创 PAT1004 成绩排名
题目:读入n(>0)名学生的姓名、学号、成绩,分别输出成绩最高和成绩最低学生的姓名和学号。输入格式:每个测试输入包含 1 个测试用例,格式为第 1 行:正整数 n第 2 行:第 1 个学生的姓名 学号 成绩第 3 行:第 2 个学生的姓名 学号 成绩 ... ... ...第 n+1 行:第 n 个学生的姓名 学号 成绩其中姓名和学号均为不超过 10 个字...
2020-02-01 22:57:52
154
原创 PAT1003 我要通过!
题目:“答案正确”是自动判题系统给出的最令人欢喜的回复。本题属于 PAT 的“答案正确”大派送 —— 只要读入的字符串满足下列条件,系统就输出“答案正确”,否则输出“答案错误”。得到“答案正确”的条件是:字符串中必须仅有P、A、T这三种字符,不可以包含其它字符; 任意形如xPATx的字符串都可以获得“答案正确”,其中x或者是空字符串,或者是仅由字母A组成的字符串;...
2020-02-01 22:56:55
140
原创 PAT 1002 写出这个数
题目:读入一个正整数n,计算其各位数字之和,用汉语拼音写出和的每一位数字。输入格式:每个测试输入包含 1 个测试用例,即给出自然数n的值。这里保证n小于10100。输出格式:在一行内输出n的各位数字之和的每一位,拼音数字间有 1 空格,但一行中最后一个拼音数字后没有空格。输入样例:1234567890987654321123456789输出...
2020-02-01 22:55:28
153
原创 PAT1001 害死人不偿命的(3n+1)猜想
题目:卡拉兹(Callatz)猜想:对任何一个正整数n,如果它是偶数,那么把它砍掉一半;如果它是奇数,那么把(3n+1)砍掉一半。这样一直反复砍下去,最后一定在某一步得到n=1。卡拉兹在 1950 年的世界数学家大会上公布了这个猜想,传说当时耶鲁大学师生齐动员,拼命想证明这个貌似很傻很天真的命题,结果闹得学生们无心学业,一心只证(3n+1),以至于有人说这是一个阴谋,卡拉兹是在蓄...
2020-02-01 22:51:01
138
原创 一个人的旅行
题目:A - 一个人的旅行题意:中文不在多说,多个起点,将这多个起点与0之间的长度定为0,最后输出多个终点中最小的距离即可;事实上这道题使用dijkstra很方便就可以得出,但是很久没有做类似的题目,想使用一下邻接表优化的spfa;第一次代码://wa未找到原因#include<iostream>#include<stdio.h>#inclu...
2020-02-01 22:44:34
161
原创 D - Primed Subsequence
题目大意;定义素数序列为长度大于等于2的切其中每个数之和为素数的一个数列,题目给出数列,让我们求出最短的素数序列,如果有长度相同的,则输出最先出现的。思路:先素数打表,考虑到是区间问题,直接用一个数组s[i]记录前i个数的和;代码:#include<stdio.h>#include<string.h>#include<math.h>using ...
2019-09-06 14:58:15
419
原创 抱歉
题目:非常抱歉,本来兴冲冲地搞一场练习赛,由于我准备不足,出现很多数据的错误,现在这里换一个简单的题目:前几天在网上查找ACM资料的时候,看到一个中学的奥数题目,就是不相交的曲线段分割平面的问题,我已经发到论坛,并且lxj 已经得到一个结论,这里就不多讲了,下面有一个类似的并且更简单的问题:如果平面上有n个点,并且每个点至少有2条曲线段和它相连,就是说,每条曲线都是封闭的,同时,我...
2019-07-15 10:50:16
169
原创 Gleaming the Cubes (思维题)
As chief engineer of the Starship Interprize, the task of repairing the hyperstellar, cubic, transwarped-out software has fallen on your shoulders. Simply put, you must compute the volume of the inter...
2019-07-15 10:46:06
275
原创 D - Ignatius and the Princess III (母函数)
题目:"Well, it seems the first problem is too easy. I will let you know how foolish you are later." feng5166 says."The second problem is, given an positive integer N, we define an equation like this...
2019-07-14 22:41:36
203
原创 C - Big Event in HDU(母函数)
题目:Nowadays, we all know that Computer College is the biggest department in HDU. But, maybe you don't know that Computer College had ever been split into Computer College and Software College in 200...
2019-07-14 22:39:56
245
原创 A - Square Coins (基础母函数)
题目描述:People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=17^2), i.e., 1-credit coins...
2019-07-14 22:13:42
178
原创 二分-Hamburgers
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread,...
2019-01-26 11:22:38
199
原创 矩阵嵌套(DAG)
题目:见紫书;思路都是根据紫书来的,然后重点是学习了一下利用结构体自定义矩阵的方法,这个方法确实比直接两两比较是否能够嵌套优化了很多;大佬的代码:https://blog.csdn.net/lilele12211104/article/details/52524171菜鸡的代码:#include<stdio.h>#include<algorithm>...
2018-09-15 10:24:37
781
原创 Almost Sorted Array(合适数列)
题目:We are all familiar with sorting algorithms: quick sort, merge sort, heap sort, insertion sort, selection sort, bubble sort, etc. But sometimes it is an overkill to use these algorithms for an al...
2018-08-30 21:19:09
1022
4
原创 Dancing Stars on Me(判断能否构成正多边形)
代码:The sky was brushed clean by the wind and the stars were cold in a black sky. What a wonderful night. You observed that, sometimes the stars can form a regular polygon in the sky if we connect th...
2018-08-30 21:14:32
411
原创 Chip Factory(暴力)
题目: John is a manager of a CPU chip factory, the factory produces lots of chips everyday. To manage large amounts of products, every processor has a serial number. More specifically, the factory pr...
2018-08-30 21:10:02
626
原创 House Building(几何体表面积)
题目:Have you ever played the video game Minecraft? This game has been one of the world's most popular game in recent years. The world of Minecraft is made up of lots of 1×1×1 blocks in a 3D map. Bloc...
2018-08-30 21:07:50
654
原创 连续正整数
题目:一个正整数有可能被表示为 n(n>=2) 个连续正整数之和,如:15=1+2+3+4+515=4+5+615=7+8请编写程序,根据输入的任何一个正整数,找出符合这种要求的所有连续正整数序列。输入数据:一个正整数,以命令行参数的形式提供给程序。输出数据:在标准输出上打印出符合题目描述的全部正整数序列,每行一个序列,每个序列都从该序列的最小正整数开始、以从小到...
2018-08-28 00:02:32
821
原创 三角形的内点(皮克定理)
题目:在一个平面坐标系中,我们可以选出三个不全在一条线上的点构成一个三角形。我们称一个在三角形内(不包含三角形的边上),横纵坐标皆为整数的点位这个三角形的内点。 对于一个由(0,0)、(n,m)、(p,0)作为顶点构成的三角形,请你设计程序求出他的内点数。输入包括一行,包括三个用空格分隔的整数,分别为n,m,p(0 ≤ n < 32000,0 < m < 32000,0 ...
2018-08-27 18:55:17
7144
原创 简单素数筛法(顾名思义)
题目:小度机器人最近正在添加功能,Robin希望小度机器人可以告诉他从1到N( 1 < N <= 10000)有多少个素数。请你来帮帮他吧?输入包括一行,仅一个数字N。输出在(1, N]区间内的所有的素数。分析:..........代码:#include<stdio.h>#include<math.h>using namespa...
2018-08-27 11:34:43
207
原创 微信钱包付款(数论 大数)
题目:微信支付是腾讯公司的支付业务品牌,以绑定银行卡的快捷支付为基础,为用户提供安全、快捷、高效的支付服务。小 Q 和他的两位好朋友一起去吃大餐,吃完后小 Q 打开微信,扫了商家提供的二维码,用微信完成了支付。现在三个人要分摊下饭钱,每个人分别需要支付 aa元,bb 元和 cc 元,定义 f(x)f(x) 为数字 xx 的各位数字之和,例如 f(123) = 1 + 2 + 3f(123)=1...
2018-08-27 11:21:47
430
原创 Find Integer(费马大定理)
题目:题意:a^n+b^n=c^n,给出a,n,求出一组b,c;分析:根据费马大定理,n>2的所有情况可以排除,n=0无结果,n=1随便写,剩下的就是n=2,利用勾股数的性质就可以写出;代码:#include<stdio.h>using namespace std;int main(){ int t,a,n,b,c; scanf...
2018-08-26 12:04:58
326
原创 无平方因子的数(Eratosthenes筛法)
题目:给出正整数n和m,区间[n,m]内的“无平方因子”的数有多少个?整数p无平方因子,当且仅当不存在k>1,使得p是k*k的倍数。1<=n<=m<=10^12,m-n<=10^7;分析:思路都是紫书上的,只是实现一下;代码:#include<stdio.h>#include<string.h>#include<m...
2018-08-24 12:14:12
1024
1
原创 Cure
Given an integer nn, we only want to know the sum of 1/k^21/k2 where kk from 11 to nn.Input FormatThere are multiple cases.For each test case, there is a single line, containing a single positiv...
2018-08-15 09:07:41
626
原创 Balanced Game
Rock-paper-scissors is a zero-sum hand game usually played between two people, in which each player simultaneously forms one of three shapes with an outstretched hand. These shapes are "rock", "paper"...
2018-08-15 09:02:36
310
原创 Plague Inc
题目:Plague Inc. is a famous game, which player develop virus to ruin the world.JSZKC wants to model this game. Let's consider the world has N\times MN×M cities. The world has NN rows and MM columns...
2018-08-13 18:28:18
381
原创 Prime Time (数论打表)
题目:Euler is a well-known matematician, and, among many other things, he discovered that the formula n 2 + n + 41 produces a prime for 0 ≤ n < 40. For n = 40, the formula produces 1681, which is 4...
2018-07-27 17:13:25
348
1
原创 Farey Sequence (欧拉函数)
题目:The Farey Sequence Fn for any integer n with n >= 2 is the set of irreducible rational numbers a/b with 0 < a < b <= n and gcd(a,b) = 1 arranged in increasing order. The first few are...
2018-07-26 11:09:23
275
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅