杭电ACM
以夕阳落款
平庸的码农
展开
-
杭电1075
题目描述:Ignatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Martian gives him a history book of Mars and a dictionary when it leaves. Now Ignatiu原创 2016-03-16 10:02:21 · 590 阅读 · 0 评论 -
杭电1200
题目描述:Mo and Larry have devised a way of encrypting messages. They first decide secretly on the number of columns and write the message (letters only) down the columns, padding with extra random le原创 2016-03-07 22:37:11 · 421 阅读 · 0 评论 -
杭电1202
题目描述:每学期的期末,大家都会忙于计算自己的平均成绩,这个成绩对于评奖学金是直接有关的。国外大学都是计算GPA(grade point average) 又称GPR(grade point ratio),即成绩点数与学分的加权平均值来代表一个学生的成绩的。那么如何来计算GPA呢?一般大学采用之计分法 A90 - 100 4 点 B80 - 89 3 点 C70原创 2016-03-07 23:05:25 · 424 阅读 · 0 评论 -
杭电1213
题目描述:Today is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that not all the friends know each原创 2016-03-07 23:47:30 · 364 阅读 · 0 评论 -
杭电1228
题目描述:读入两个小于100的正整数A和B,计算A+B.需要注意的是:A和B的每一位数字由对应的英文单词给出.水题,注意格式,直接上AC:using System;namespace a1{ class Program { public static int Trans(string s){ if(s=="zero") return 0;原创 2016-03-08 00:04:23 · 270 阅读 · 0 评论 -
杭电1219
题目描述:Ignatius is doing his homework now. The teacher gives him some articles and asks him to tell how many times each letter appears.It's really easy, isn't it? So come on and AC ME.水题,注意格式,原创 2016-03-08 11:12:23 · 580 阅读 · 0 评论 -
杭电1211
题目描述:RSA is one of the most powerful methods to encrypt data. The RSA algorithm is described as follow:> choose two large prime integer p, q> calculate n = p × q, calculate F(n) = (p - 1) ×原创 2016-03-08 11:33:28 · 534 阅读 · 0 评论 -
杭电1217
题目描述: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原创 2016-03-08 12:43:20 · 374 阅读 · 0 评论 -
杭电1711
题目描述:Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N <= 1000000). Your task is to find a number K which make a[K] = b[1], a[K + 1原创 2016-03-09 12:45:33 · 352 阅读 · 0 评论 -
杭电2501
题目描述:有一个大小是 2 x n 的网格,现在需要用2种规格的骨牌铺满,骨牌规格分别是 2 x 1 和 2 x 2,请计算一共有多少种铺设的方法。首先全是1有1种,接下来用1个,2个,……n/2个去填充,设f(n,k)为n内k个2的填充种数,则i个有pow(2,i)*f(n,i)种,写个递归然后累加即可,AC代码:#include#includeint Combi原创 2016-03-09 16:31:03 · 362 阅读 · 0 评论 -
杭电2539
题目描述:在足球比赛中,有不少赛事,例如世界杯淘汰赛和欧洲冠军联赛淘汰赛中,当比赛双方经过正规比赛和加时赛之后仍然不分胜负时,需要进行点球大战来决定谁能够获得最终的胜利。点球大战的规则非常简单,两方轮流派出球员罚点球,每方各罚5个。当5轮点球结束以后如果仍然不分胜负,则进入一轮定胜负的阶段。两方各派一名球员罚点球,直到有一方罚进而另一方没有进为止。在北美职业冰球联赛中,也有点球大战。与足球原创 2016-03-10 15:48:05 · 361 阅读 · 0 评论 -
杭电2537
题目描述:8球是一种台球竞赛的规则。台面上有7个红球、7个黄球以及一个黑球,当然还有一个白球。对于本题,我们使用如下的简化规则:红、黄两名选手轮流用白球击打各自颜色的球,如果将该颜色的7个球全部打进,则这名选手可以打黑球,如果打进则算他胜。如果在打进自己颜色的所有球之前就把黑球打进,则算输。如果选手不慎打进了对手的球,入球依然有效。现在给出打进的球(白球除外)的顺序,以及黑球由哪方打进原创 2016-03-10 15:58:48 · 442 阅读 · 0 评论 -
杭电2535
题目描述:美国大选是按各州的投票结果来确定最终的结果的,如果得到超过一半的州的支持就可以当选,而每个州的投票结果又是由该州选民投票产生的,如果某个州超过一半的选民支持希拉里,则她将赢得该州的支持。现在给出每个州的选民人数,请问希拉里至少需要赢得多少选民的支持才能当选?排序然后从小到n/2累加即可,AC代码:#include#includeusing namesp原创 2016-03-10 19:56:30 · 425 阅读 · 0 评论 -
杭电2802
题目描述:Giving the N, can you tell me the answer of F(N)?数学题:推导一下:f(2*n)=8*n^3-20f(2*n-1)=4*n^3-3*n^2代码:#include#includeint main(){ int n; while(scanf("%d",&n)!=EOF && n!=原创 2016-03-12 12:26:46 · 373 阅读 · 0 评论 -
杭电2571
题目描述:穿过幽谷意味着离大魔王lemon已经无限接近了!可谁能想到,yifenfei在斩杀了一些虾兵蟹将后,却再次面临命运大迷宫的考验,这是魔王lemon设下的又一个机关。要知道,不论何人,若在迷宫中被困1小时以上,则必死无疑!可怜的yifenfei为了去救MM,义无返顾地跳进了迷宫。让我们一起帮帮执着的他吧!命运大迷宫可以看成是一个两维的方格阵列,如下图所示:y原创 2016-03-12 16:13:26 · 470 阅读 · 0 评论 -
杭电1284
题目描述:在一个国家仅有1分,2分,3分硬币,将钱N兑换成硬币有很多种兑法。请你编程序计算出共有多少种兑法。背包问题,不过3,2用完后1肯定可以填满剩下的空当,AC代码:using System;namespace a1{ class Program { public static void Main(string[] args) { int n;原创 2016-03-07 21:09:12 · 322 阅读 · 0 评论 -
杭电2071
题目描述:There are some students in a class, Can you help teacher find the highest student .简直是最水的题了,不过打算从后面开始要用C#提交了,所以先水一把,AC代码:using System;using System.Collections.Generic;using System.L原创 2016-03-07 21:01:59 · 645 阅读 · 0 评论 -
杭电1066
题目描述:The expression N!, read as "N factorial," denotes the product of the first N positive integers, where N is nonnegative. So, for example, N N! 0 1 1 1 2 2 3 6 4 24 5 120 10 36288原创 2016-03-16 11:25:18 · 737 阅读 · 0 评论 -
杭电2132
题目描述:We once did a lot of recursional problem . I think some of them is easy for you and some if hard for you.Now there is a very easy problem . I think you can AC it. We can define sum(n) as f原创 2016-03-16 15:07:48 · 673 阅读 · 0 评论 -
杭电1249
题目描述:用N个三角形最多可以把平面分成几个区域?水题,用的数学知识:t(1)=2 t(n)=t(n-1)+6*(n-1)归纳一下,t(n)=2+6*(n*(n+1)/2-n),代码:#include#includeint main(){ int n; scanf("%d",&n); while(n--){ int m; scanf("%d",&m原创 2016-03-04 17:37:14 · 469 阅读 · 0 评论 -
杭电1230
题目描述:读入两个不超过25位的火星正整数A和B,计算A+B。需要注意的是:在火星上,整数不是单一进制的,第n位的进制就是第n个素数。例如:地球上的10进制数2,在火星上记为“1,0”,因为火星个位数是2进制的;地球上的10进制数38,在火星上记为“1,1,1,0”,因为火星个位数是2进制的,十位数是3进制的,百位数是5进制的,千位数是7进制的……这道题就是拓展的A+B吧,原创 2016-03-04 18:26:30 · 440 阅读 · 0 评论 -
杭电1262
题目描述:哥德巴赫猜想大家都知道一点吧.我们现在不是想证明这个结论,而是想在程序语言内部能够表示的数集中,任意取出一个偶数,来寻找两个素数,使得其和等于该偶数.做好了这件实事,就能说明这个猜想是成立的.由于可以有不同的素数对来表示同一个偶数,所以专门要求所寻找的素数对是两个值最相近的.直接上代码:#include #include int Judge原创 2016-03-04 18:59:10 · 382 阅读 · 0 评论 -
杭电1196
题目描述:Given an positive integer A (1 For example, given A = 26, we can write A in binary form as 11010, so the lowest bit of A is 10, so the output should be 2.Another example goes like this:原创 2016-03-04 16:50:38 · 560 阅读 · 0 评论 -
杭电1715
题目描述:Fibonacci数列,定义如下:f(1)=f(2)=1f(n)=f(n-1)+f(n-2) n>=3。计算第n项Fibonacci数值。用斐波那契数列的通项计算一下,(((1+sqrt(5))/2)^1000-((1-sqrt(5))/2)^1000)/sqrt(5)=4.3*10^208,数据很大,不是一般的数据类型可以存储下的,所以考虑大数计算,用a[100原创 2016-03-05 09:55:13 · 409 阅读 · 0 评论 -
杭电1042
题目描述:意思就是求N的阶乘,1≤N≤10000,用log估计一下,有30000+位,没有数据类型可以存储下了,肯定是用大数乘法了,写一个代码:#includeint a[10002][40000]={0};int b[10002];//存储每个数的阶乘有几位int main(){ int i; a[0][0]=1; a[1][0]=1; a[2][0]=2; b[0]=1原创 2016-03-05 10:54:53 · 341 阅读 · 0 评论 -
杭电1047
题目描述:不描述了,和那些大数相加一样吧,注意格式AC代码:#include#include#define N 105void add(char a[],char b[],char c[]){ int i,e,d; int n,m; char temp; n=strlen(a); m=strlen(b); for(i=0; i<n/原创 2016-03-05 11:04:42 · 877 阅读 · 0 评论 -
杭电1316
题目描述:Recall the definition of the Fibonacci numbers: f1 := 1 f2 := 2 fn := fn-1 + fn-2 (n >= 3) Given two numbers a and b, calculate how many Fibonacci numbers are in the range [a, b].原创 2016-03-05 17:39:33 · 409 阅读 · 1 评论 -
杭电1019
题目描述:The least common multiple (LCM) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set. For example, the LCM of 5, 7 and 15 is 105.这道题原创 2016-03-05 19:34:33 · 314 阅读 · 0 评论 -
杭电1098
题目描述:Ignatius is poor at math,he falls across a puzzle problem,so he has no choice but to appeal to Eddy. this problem describes that:f(x)=5*x^13+13*x^5+k*a*x,input a nonegative integer k(k<10000),t原创 2016-03-05 20:21:55 · 394 阅读 · 0 评论 -
杭电1250
题目描述:A Fibonacci sequence is calculated by adding the previous two members the sequence, with the first two members being both 1.F(1) = 1, F(2) = 1, F(3) = 1,F(4) = 1, F(n>4) = F(n - 1) + F(n-2) +原创 2016-03-06 13:57:26 · 479 阅读 · 0 评论 -
杭电1164
题目描述:Eddy's interest is very extensive, recently he is interested in prime number. Eddy discover the all number owned can be divided into the multiply of prime number, but he can't write program, so原创 2016-03-07 20:31:16 · 1203 阅读 · 0 评论 -
杭电2572
题目描述:最后的挑战终于到了!站在yifenfei和MM面前的只剩下邪恶的大魔王lemon一人了!战胜他,yifenfei就能顺利救出MM。Yifenfei和魔王lemon的挑战很简单:由lemon给出三个字符串,然后要yifenfei说出第一串的某个子串,要求该子串长度最小,并且同时包含第2个串和第3个串。特别地,如果有多个这样的子串,则请输出字母序最小的一个。原创 2016-03-13 17:24:14 · 617 阅读 · 0 评论