04 2014 档案
摘要:Aggressive cowsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5436Accepted: 2720DescriptionFarmer John has built a new long barn, with N (2 #include #include using namespace std;const int maxn=100002;const int inf=0x7fffffff;int x[maxn];int n,c;bool ok(int m){ int last=0; for(int i=1...
阅读全文
摘要:Cable masterTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 21071Accepted: 4542DescriptionInhabitants of the Wonderland have decided to hold a regional programming contest. The Judging Committee has volunteered and has promised to organize the most honest contest ever. It was decided to con
阅读全文
摘要:Constructing Roads In JGShining's KingdomTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 14635Accepted Submission(s): 4158Problem DescriptionJGShining's kingdom consists of 2n(n is no more than 500,000) small cities which are located in two
阅读全文
摘要:Pick applesTime Limit: 1000MS Memory limit: 165536K题目描述Once ago, there is a mystery yard which only produces three kinds of apples. The number of each kind is infinite. A girl carrying a big bag comes into the yard. She is so surprised because she has never seen so many apples before. Each kind of a
阅读全文
摘要:sscanf() - 从一个字符串中读进与指定格式相符的数据. 函数原型: Int sscanf( string str, string fmt, mixed var1, mixed var2 ... ); int scanf( const char *format [,argument]... ); 说明: sscanf与scanf类似,都是用于输入的,只是后者以屏幕(stdin)为输入源,前者以固定字符串为输入源。 其中的format可以是一个或多个 {%[*] [width] [{h | l | I64 | L}]type | ' ' | '\t' | &
阅读全文
摘要:今天上午九点到下午两点,我们做了山东省第三届ACM原题,整体结果还比较不错,我们队做出了4道题,两道模拟,一道字符串处理,一道高数问题。比赛前期我们配合得不错,比较快速的A出了两道模拟题。但后来状态不太好,主要是我的问题,后来我做的是那道字符串处理的题目,有点麻烦,分割单词,然后在单词中提取数字,数字还不是标准的,做了好长时间,终于测试数据过了,提交了一下,结果果断地返回了一个WA,那种感觉太纠结了,就像当头一棒,千辛万苦弄出来的一个,还是WA,用来队友给我说得考虑空格,两个单词之间可能有一个或多个空格,天哪,我是完全按照一个空格来算的。好吧,机器让给队友,我再修改那个代码。改来改去,反而越.
阅读全文
摘要:Fruit Ninja IITime Limit: 5000MS Memory limit: 65536K题目描述Have you ever played a popular game named "Fruit Ninja"?Fruit Ninja (known as Fruit Ninja HD on the iPad and Fruit Ninja THD for Nvidia Tegra 2 based Android devices) is a video game developed by Halfbrick. It was released April 21,
阅读全文
摘要:The Best Seat in ACM ContestTime Limit: 1000ms Memory limit: 65536K有疑问?点这里^_^题目描述Cainiao is a university student who loves ACM contest very much. It is a festival for him once when he attends ACM Asia Regional Contest because he always can find some famous ACMers there.Cainiao attended Asia Regional
阅读全文
摘要:n a^o7 !Time Limit: 1000MS Memory limit: 65536K题目描述All brave and intelligent fighters, next you will step into a distinctive battleground which is full of sweet and happiness. If you want to win the battle, you must do warm-up according to my instructions, which can make you in the best state prepar
阅读全文
摘要:能量项链Time Limit: 1000 MSMemory Limit: 32768 KTotal Submit: 55(20 users)Total Accepted: 22(19 users)Rating:Special Judge:NoDescription在Mars星球上,每个Mars人都随身佩带着一串能量项链。在项链上有N颗能量珠。能量珠是一颗有头标记与尾标记的珠子,这些标记对应着某个正整数。并且,对于相邻的两颗珠子,前一颗珠子的尾标记一定等于后一颗珠子的头标记。因为只有这样,通过吸盘(吸盘是Mars人吸收能量的一种器官)的作用,这两颗珠子才能聚合成一颗珠子,同时释放出可以被吸盘吸收
阅读全文
摘要:代码:#include #include #include #include #include using namespace std;int dx[4]={0,-1,1,0};//方向int dy[4]={-1,0,0,1};bool vis[6][6];int total=0;//多少可到达路径int sx=1,sy=1;//入口出口坐标int ex=4,ey=4;int num[10][10];//广搜时记录到达当前点的最少步数struct P{ int x,y;}point[40];//用来记录可到达路径struct PP{ int fx,fy;}path[10][10];...
阅读全文
摘要:代码:#include #include #include using namespace std;const int N=100;int c[N];//皇后第i行放在第几列上int n,total;int cc;//方法数void dfs(int cur){ if(cur>n) { cout>n; if(n<=0) { cout<<"输入不合法,程序退出!"<<endl; break; } cc=1; total=0; dfs(1); ...
阅读全文
摘要:SequenceTime Limit: 1000ms Memory limit: 65536K有疑问?点这里^_^题目描述Given an integer number sequence A of length N (1#include #include using namespace std;const int maxn=1010;int num[maxn];long long sum[maxn];long long dp[maxn];int min(int a,int b){ return a>b?b:a;}int main(){ int t;cin>>t; int n,
阅读全文
摘要:#include #include using namespace std;#define mod 100007int mi(int d,int n)//快速幂运算 思想 2的4次方可以 2的平方乘以2的平凡{ int ans=1; while(n) { if(n%2==1) ans=ans*d%mod;//这条语句肯定执行的 d=d*d%mod; n/=2; } return ans;}int main(){ cout<<mi(2,5)<<endl; return 0;}
阅读全文
摘要:括号匹配Time Limit : 2000/1000ms (Java/Other)Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 110Accepted Submission(s) : 46Font:Times New Roman|Verdana|GeorgiaFont Size:←→Problem Description描述 给你一个字符串,里面只包含"(",")","[","]"四种符号,请问你需要至少添加多少个括号才能使这些括号匹配起
阅读全文
摘要:Brackets SequenceTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 23884Accepted: 6727Special JudgeDescriptionLet us define a regular brackets sequence in the following way:1. Empty sequence is a regular sequence. 2. If S is a regular sequence, then (S) and [S] are both regular sequences. 3.
阅读全文
摘要:时间过得真快,转眼间现在马上就到了毕业的时候了。大学四年的生活就这样在漫不经心中度过,在这四年里我留下了许多值得回忆的东西。参加acm的经历和体会和其他美好的经历一样,永远值得我回忆和珍惜。一个偶然,我报考了兰州大学计算机科学与技术系;又一个偶然,我开始了解acm,开始慢慢喜欢上acm。我相信这都不是偶然,或许是我们所说的缘分。2003年我从一个小县城来到兰州大学,那时我计算机几乎没有任何了解,也从来没有接触过计算机。现在我还清楚的记得大一时的上机课,我在internet explore的地址栏里面练习了三个小时的打字,为知道了如何实现大小写字母的转换而欣喜。回想起那时的自己真的感到很幼稚,但
阅读全文
摘要:CoinsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6347Accepted Submission(s): 2589Problem DescriptionWhuacmers use coins.They have coins of value A1,A2,A3...An Silverland dollar. One day Hibix opened purse and found there were some coins. He dec
阅读全文
摘要:Problem Description急!灾区的食物依然短缺!为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其价格不等,并且只能整袋购买。请问:你用有限的资金最多能采购多少公斤粮食呢?后记:人生是一个充满了变数的生命过程,天灾、人祸、病痛是我们生命历程中不可预知的威胁。月有阴晴圆缺,人有旦夕祸福,未来对于我们而言是一个未知数。那么,我们要做的就应该是珍惜现在,感恩生活——感谢父母,他们给予我们生命,抚养我们成人;感谢老师,他们授给我们知识,教我们做人感谢朋友,他们让我们感受到世界的温暖;感谢对手,他们令我
阅读全文
摘要:LeyniTime Limit: 3000 MSMemory Limit: 65536 KTotal Submit: 247(56 users)Total Accepted: 78(53 users)Rating:Special Judge:NoDescriptionLeyni被人掳走,身在水深火热之中...小奈叶为了拯救Leyni,独自一人前往森林深处从静竹手中夺回昏迷中的Leyni。历经千辛万苦,小奈叶救出了Leyni,但是静竹为此极为恼怒,决定对他们发起最强烈的进攻。不过小奈叶有一个叫做能量保护圈的道具,可以保护他们。这个保护圈由n个小的小护盾围成一圈,从1到n编号。当某一块小护盾受到攻
阅读全文
摘要:IdentifiersTime Limit: 1000ms Memory limit: 65536K有疑问?点这里^_^题目描述Identifier is an important concept in the C programming language. Identifiers provide names for several language elements, such as functions, variables, labels, etc.An identifier is a sequence of characters. A valid identifier can conta
阅读全文
摘要:汽车比赛Time Limit: 1000 MSMemory Limit: 65536 KTotal Submit: 188(56 users)Total Accepted: 72(50 users)Rating:Special Judge:NoDescriptionXianGe非常喜欢赛车比赛尤其是像达喀尔拉力赛,这种的比赛规模很大,涉及到很多国家的车队的许多车手参赛。XianGe也梦想着自己能举办一个这样大规模的比赛,XianGe幻想着有许多人参赛,那是人山人海啊,不过XianGe只允许最多100000人参加比赛。这么大规模的比赛应该有技术统计,在XianGe的比赛中所有车辆的起始点可能不同
阅读全文
摘要:Binomial CoeffcientsTime Limit: 1000ms Memory limit: 65536K有疑问?点这里^_^题目描述输入输出示例输入31 110 2954 723示例输出1453557658提示来源山东省第二届ACM大学生程序设计竞赛解题思路:这道题坑死我了。。本来很简单的一道题,却怎么也做不对。。就是求组合数,结果对10000003取模。一开始对c(m,n)是用公式直接求的,但是计算过程中涉及到取余,不能用以下代码写:int c(int m,int n){ int sum=1; for(int i=1;i#include using namespac...
阅读全文
摘要:Mathman BankTime Limit: 1000ms Memory limit: 65536K有疑问?点这里^_^题目描述With the development of mathmen's mathematics knowlege, they have finallyinvented computers. Therefore, they want to use computers to manage theirbanks. However, mathmen's programming skills are not as good as theirmath- ematic
阅读全文
摘要:StarsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 30272Accepted: 13206DescriptionAstronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are not higher and not to
阅读全文
摘要:敌兵布阵Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 36928Accepted Submission(s): 15589Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人
阅读全文
摘要:A Simple Problem with IntegersTime Limit: 5000MSMemory Limit: 131072KTotal Submissions: 55273Accepted: 16628Case Time Limit: 2000MSDescriptionYou have N integers, A1, A2, ... ,AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a giv
阅读全文
摘要:BillboardTime Limit: 20000/8000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8962Accepted Submission(s): 3997Problem DescriptionAt the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the
阅读全文
摘要:Just a HookTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 14942Accepted Submission(s): 7409Problem DescriptionIn the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecu
阅读全文
摘要:Ivan comes again!Time Limit: 1000ms Memory limit: 65536K有疑问?点这里^_^题目描述The Fairy Ivan gave Saya three problems to solve (Problem F). After Saya finished the first problem (Problem H), here comes the second.This is the enhanced version of Problem H.There is a large matrix whose row and column are less
阅读全文
摘要:I Hate ItTime Limit: 9000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 33125Accepted Submission(s): 13059Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。在每
阅读全文
摘要:敌兵布阵Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 36806Accepted Submission(s): 15545Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人
阅读全文
摘要:小希的迷宫Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 23418Accepted Submission(s): 7186Problem Description上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提
阅读全文
摘要:Farm IrrigationTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4962Accepted Submission(s): 2130Problem DescriptionBenny has a spacious farm land to irrigate. The farm land is a rectangle, and is divided into a lot of samll squares. Water pipes are
阅读全文
摘要:剪刀石头布Time Limit : 2000/1000ms (Java/Other)Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 47Accepted Submission(s) : 18Font:Times New Roman|Verdana|GeorgiaFont Size:←→Problem Description现有M个人一起玩剪刀石头布,以1-M编号,每人出一种,出过不再改变,但是我们并不知道它到底是哪一种。 (其中石头赢剪刀,剪刀赢布,布赢石头,一样则平)裁判用两种说法对这M个人所构成的输赢关系进行描述:
阅读全文
摘要:Oil DepositsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10647Accepted Submission(s): 6179Problem DescriptionThe GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangu
阅读全文
摘要:食物链Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 41134Accepted: 11965Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是"1 X Y",表示X和Y是同类。 第二种说法是"2 X Y",表示X吃Y。 此人对N个动物,用上述两种说法,一句接一句
阅读全文
摘要:BalloonsTime Limit: 1000ms Memory limit: 65536K有疑问?点这里^_^题目描述Both Saya and Kudo like balloons. One day, they heard that in the central park, there will be thousands of people fly balloons to pattern a big image.They were very interested about this event, and also curious about the image.Since there
阅读全文
摘要:Greatest NumberTime Limit: 1000ms Memory limit: 65536K有疑问?点这里^_^题目描述Saya likes math, because she think math can make her cleverer.One day, Kudo invited a very simple game:GivenNintegers, then the players choose no more than four integers from them (can be repeated) and add them together. Finally, th
阅读全文
摘要:How Many TablesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11580Accepted Submission(s): 5696Problem DescriptionToday is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he nee
阅读全文
摘要:位图像素的颜色Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 0Accepted Submission(s): 0Problem Description有一个在位图上画出矩形程序,一开始位图都被初始化为白色(RGB颜色表示为R=G=B=255)。该程序能够按照顺序绘出N个矩形。新绘制的矩形能够覆盖位图上原有的颜色。程序执行完毕后,需要查询M个点的颜色,输出这些点的RGB值。每组数据都是在初始化后开始绘制。Input第一行包含参数N和M,分别表示
阅读全文
摘要:S-NimTime Limit: 5000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4004Accepted Submission(s): 1732Problem DescriptionArthur and his sister Caroll have been playing a game called Nim for some time now. Nim is played as follows:The starting position has a number
阅读全文
摘要:Fibonacci again and againTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4152Accepted Submission(s): 1735Problem Description任何一个大学生对菲波那契数列(Fibonacci numbers)应该都不会陌生,它是这样定义的:F(1)=1;F(2)=2;F(n)=F(n-1)+F(n-2)(n>=3);所以,1,2,3,5,8,13……就是菲波那契数列。在HDOJ上有
阅读全文
摘要:取(m堆)石子游戏Time Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1466Accepted Submission(s): 853Problem Descriptionm堆石子,两人轮流取.只能在1堆中取.取完者胜.先取者负输出No.先取者胜输出Yes,然后输出怎样取子.例如5堆 5,7,8,9,10先取者胜,先取者第1次取时可以从有8个的那一堆取走7个剩下1个,也可以从有9个的中那一堆取走9个剩下0个,也可以从有10个的中那一堆取走7个剩下3个
阅读全文
摘要:Being a Good Boy in Spring FestivalTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3819Accepted Submission(s): 2269Problem Description一年在外 父母时刻牵挂春节回家 你能做几天好孩子吗寒假里尝试做做下面的事情吧陪妈妈逛一次菜场悄悄给爸爸买个小礼物主动地 强烈地 要求洗一次碗某一天早起 给爸妈用心地做回早餐如果愿意 你还可以和爸妈说咱们玩个小游戏吧 ACM课上学
阅读全文
摘要:A Funny GameTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3795Accepted: 2268DescriptionAlice and Bob decide to play a funny game. At the beginning of the game they pick n(1 3, we use c1, c2, ..., cn to denote the coins clockwise and if Alice remove c2, then c1 and c3 are NOT adjacent! (B.
阅读全文
摘要:Problem Description有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策略,问最后你是胜者还是败者。如果你胜,你第1次怎样取子?Input输入包含若干行,表示若干种石子的初始情况,其中每一行包含两个非负整数a和b,表示两堆石子的数目,a和b都不大于1,000,000,且a#include #include #include using namespace std;
阅读全文
摘要:取石子游戏Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 33061Accepted: 10990Description有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策略,问最后你是胜者还是败者。Input输入包含若干行,表示若干种石子的初始情况,其中每一行包含两个非负整数a和b,表示两堆石子的数目,a和b都不大
阅读全文
摘要:Problem Description又到了选课的时间了,xhd看着选课表发呆,为了想让下一学期好过点,他想知道学n个学分共有多少组合。你来帮帮他吧。(xhd认为一样学分的课没区别)Input输入数据的第一行是一个数据T,表示有T组数据。每组数据的第一行是两个整数n(1 #include using namespace std;int c[45],temp[45];int a[11],b[11];int main(){ int t;cin>>t; int n,k; while(t--) { cin>>n>>k; for(int i=1;i>a...
阅读全文
摘要:Word IndexTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 4541Accepted: 2567DescriptionEncoding schemes are often used in situations requiring encryption or information storage/transmission economy. Here, we develop a simple encoding scheme that encodes particular types of words with five o
阅读全文
摘要:Game of ConnectionsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2923Accepted Submission(s): 1649Problem DescriptionThis is a small but ancient game. You are supposed to write down the numbers 1, 2, 3, ... , 2n - 1, 2n consecutively in clockwise
阅读全文
摘要:代码:#include #include using namespace std;int c[11][11];void init(){ memset(c,0,sizeof(c)); c[0][0]=c[1][0]=c[1][1]=1; for(int i=2;i<=10;i++) { c[i][0]=c[i][i]=1; for(int j=1;j<i;j++) c[i][j]=c[i-1][j]+c[i-1][j-1]; }}int main(){ init(); cout<<c[3][2]<<end...
阅读全文
摘要:排列组合Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2132Accepted Submission(s): 877Problem Description有n种物品,并且知道每种物品的数量。要求从中选出m件物品的排列数。例如有两种物品A,B,并且数量都是1,从中选2件物品,则排列有"AB","BA"两种。Input每组输入数据有两行,第一行是二个数n,m(1#include #include #incl
阅读全文
摘要:排列组合Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2119Accepted Submission(s): 875Problem Description有n种物品,并且知道每种物品的数量。要求从中选出m件物品的排列数。例如有两种物品A,B,并且数量都是1,从中选2件物品,则排列有"AB","BA"两种。Input每组输入数据有两行,第一行是二个数n,m(1#include using namespac
阅读全文
摘要:最大报销额Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 14982Accepted Submission(s): 4240Problem Description现有一笔经费可以报销一定额度的发票。允许报销的发票类型包括买图书(A类)、文具(B类)、差旅(C类),要求每张发票的总额不得超过1000元,每张发票上,单项物品的价值不得超过600元。现请你编写程序,在给出的一堆发票中找出可以报销的、不超过给定额度的最大报销额。Input测试输入包含若
阅读全文
摘要:小兔的棋盘Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5814Accepted Submission(s): 3186Problem Description小兔的叔叔从外面旅游回来给她带来了一个礼物,小兔高兴地跑回自己的房间,拆开一看是一个棋盘,小兔有所失望。不过没过几天发现了棋盘的好玩之处。从起点(0,0)走到终点(n,n)的最短路径数是C(2n,n),现在小兔又想如果不穿越对角线(但可接触对角线上的格点),这样的路径数有多少?小兔想了很
阅读全文
摘要:DescriptionIn how many ways can you choose k elements out of n elements, not taking order into account?Write a program to compute this number. InputThe input will contain one or more test cases. Each test case consists of one line containing two integers n (n>=1) and k (0using namespace std;const
阅读全文
摘要:思路:用一个栈起到过渡的作用。先将队列中的元素放入栈中,然后初始化队列,再将元素从栈中取出放到初始化的队列中。代码:#include #include #include using namespace std;const int maxn=10;typedef struct{ char data[maxn]; int front,rear;}Queue;typedef struct{ char data[maxn]; int top;}Stack;void Reverse(Queue &q,Stack &s){ s.top=-1; while(q.front...
阅读全文
摘要:括号配对问题时间限制:3000 ms | 内存限制:65535 KB难度:3描述 现在,有一行括号序列,请你检查这行括号是否配对。输入 第一行输入一个数N(0#include #include using namespace std;char e[10000];bool match(stack s,char e[],int n){ for(int i=0;i>t; while(t--) { cin>>e; int len=strlen(e); stacks; if(match(s,e,len)) c...
阅读全文
摘要:前两天,蓝桥杯的成绩出来了,令我想不到的是,竟然得了一等奖。真的很意外,因为当我从考场出来的那一刻就觉得自己做得很差,大题没有做出来,占了41分,小题做得还可以。这样的结果令我意外,也令我震惊,生活就是这样,总是喜欢跟人开玩笑,也总是充满着惊喜与机遇。 省赛得一等奖也就意味着可以去北京参加决赛了,这实在很令人兴奋,很早以前就对北京充满着无限向往,也总想着有一天能去看看它。终于,这个愿望在两个月后就可以实现了。回顾这次省赛,心情起起落落,有过欢乐,也有过悲伤,有过期待,也有过失望,还好以较好的结果结束,从中我也想到了一条,不要太早给自己下结论。做完一件事,要多向好的方面想,不能让消极的情绪影响.
阅读全文
摘要:1、定义一个静态成员方法,该方法用于提取文件名。比如,给定一个字符串“c:\program files\Maths\all.dat”,使用该方法即可获取文件名all.dat。自行设计程序验证上述方法正确性。 public static string getFilename(stringfile) { //提示:主体中使用string类的indexof方法和substring方法 }代码:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace sr{ class ...
阅读全文
摘要:找新朋友Time Limit: 2000/1000 MS(Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s):6928Accepted Submission(s): 3593Problem Description新年快到了,“猪头帮协会”准备搞一个聚会,已经知道现有会员N人,把会员从1到N编号,其中会长的号码是N号,凡是和会长是老朋友的,那么该会员的号码肯定和N有大于1的公约数,否则都是新朋友,现在会长想知道究竟有几个新朋友?请你编程序帮会长计算出来。Input第一行是测试数据的组数CN(Casenu
阅读全文
摘要:/*队空条件:front=rear队满条件:(rear+1)%MaxSize=front进队e操作:rear=(rear+1)%MaxSize; 将e放在rear处出队操作:front=(front+1)%MaxSize;取出front处元素e; */#include #include using namespace std;const int maxn=4;typedef struct{ int data[maxn]; int front,rear;}queue;//初始化队列void init(queue *&q){ q=(queue*)malloc(sizeof(que...
阅读全文
摘要:代码:#include #include using namespace std;const int maxn=500;typedef struct{ int data[maxn]; int front,rear;}queue;//初始化队列void init(queue *&q){ q=(queue*)malloc(sizeof(queue)); q->rear=q->front=-1;}//销毁队列void destroy(queue *&q){ free(q);}//判断队列是否为空bool empty(queue *&q){ return q->
阅读全文
摘要:#include #include using namespace std;typedef struct linknode{ int data; struct linknode *next;}Listack;//初始化栈void init(Listack *&s){ s=(Listack*)malloc(sizeof(Listack)); s->next=NULL;}//摧毁栈void destroy(Listack *&s){ Listack *p=s,*q=s->next; while(q!=NULL) { free(p); ...
阅读全文
摘要:#include #include using namespace std;const int maxn=500;typedef struct { int data[maxn]; int top;}Stack;//初始化stackvoid init(Stack *&s){ s=(Stack *)malloc(sizeof(Stack)); s->top=-1;}//销毁stackvoid destroy(Stack *&s){ free(s);}//判断栈是否为空bool empty(Stack *s){ return (s->top==-1);}//进stackv
阅读全文
摘要:吃糖果Time Limit: 6000/3000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 21695Accepted Submission(s): 6185Problem DescriptionHOHO,终于从Speakless手上赢走了所有的糖果,是Gardon吃糖果时有个特殊的癖好,就是不喜欢将一样的糖果放在一起吃,喜欢先吃一种,下一次吃另一种,这样;可是Gardon不知道是否存在一种吃糖果的顺序使得他能把所有糖果都吃完?请你写个程序帮忙计算一下。Input第一行有一个整数T
阅读全文
摘要:Leonardo's NotebookTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 1791Accepted: 787Description— I just bought Leonardo's secret notebook! Rare object collector Stan Ucker was really agitated but his friend, special investigator Sarah Kepticwas unimpressed.— How do you know it is ge
阅读全文

浙公网安备 33010602011771号