“浪潮杯”山东省第六届ACM大学生程序设计竞赛正赛题目
第六届大赛规则说明与解读蓝桥杯.ppt

FAQ
与ACM异同?
题目的精神类似。 算法相关题目居多。 数学相关题目居多。 难度较低,考虑到普及性问题。
难度的趋势是逐年提高
目前还没有实现在线提交与评分。会逐渐引用。
今年将试行全部机器阅卷。
不是团队参赛方式。 各组别,赛区单独评奖。
Page 8
FAQ
编程大题如何评分?
Page 30
评分方法(3)
编程大题 主要依据程序自动测试运行结果
编译不通过的直接按0分记 多个测试用例,每个用例单独测试,单独计分 最后求累计分数
存在问题
测试用例与题面举例不同,不能用printf System.out.println 蒙混 使用标准输入、输出。 便于重定向测试。 严格按题目要求,不要画蛇添足。输出的内容不要有多余的东西。
分值较高 有一定难度 首先,代码必须能编译通过
环境差异问题,注意选择自己的编译环境。
程序必须能运行通过 以特定用例测试程序 性能的衡量 [8]
Page 9
FAQ
是否要精通《数据结构》
了解经典算法对解题有帮助 并非是考察经典算法 总是需要一些创造性 ”发明算法“是经验与智慧的”合力“
Page 25
关于递归
递归是解决复杂问题的重要手段 需要掌握递归与循环的转化关系 有些结果填空题或大题完全放弃递归会很吃力
排列问题举例[9] n次取字母[10]
Page 26
评分
全程机器阅卷。必要环节有少量人工介入。 结果填空题: 答案唯一。 只有 0 分或满分(格式错误为 0 分)。 程序填空题: 按选手填写的代码代入程序中能否得出正确结果为判据。 测试数据与题面中的数据可能不同。 只有 0 分或满分(格式错误为 0 分) c/c++组选错了编译器类型可能得 0 分。
ACM题库完整版

#include<stdio.h> int type(int); char week[7][10]={"saturday","sunday","monday","tuesday","wednesday","thursday","friday"}; int year[2]={365,366}; int month[2][12]={31,28,31,30,31,30,31,31,30,31,30,31,31,29,31,30,31,30,31,31,30,31,30,31}; int main(void) { int days,dayofweek; int i=0,j=0; while(scanf("%d",&days)&&days!=-1) { dayofweek=days%7; for(i=2000;days>=year[type(i)];i++) days-=year[type(i)]; for(j=0;days>=month[type(i)][j];j++) days-=month[type(i)][j]; printf("%d-%02d-%02d%s\n",i,j+1,days+1,week[dayofweek]); } return 0; } int type(int m) { if(m%4!=0||(m%100==0&&m%400!=0)) return 0; else return 1; }
登山
1.题目描述 五一到了,NUIST-ACM队组织大家去登 山观光,队员们发现山上一个有N个景点, 并且决定按照顺序来浏览这些景点,即 每次所浏览景点的编号都要大于前一个 浏览景点的编号。同时队员们还有另一 个登山习惯,就是不连续浏览海拔相同 的两个景点,并且一旦开始下山,就不 再向上走了。队员们希望在满足上面条 件的同时,尽可能多的浏览景点,你能 帮他们找出最多可能浏览的景点数么? 2.输入 Line 1: N (2 <= N <= 1000) 景点数 Line 2: N个整数,每个景点的海拔 3.输出 最多能浏览的景点数 4.样例输入 8 186 186 150 200 160 130 197 220 5.样例输出 4
ACM软件大赛之编程大赛题目(附部分答案)

ACM 软件大赛之编程大赛比赛注意事项:l 比赛时间为3小时(小时(180180分钟);比赛分两个阶段:第一阶段限时30分钟,完成公示的3题,第二阶段限时150分钟(事先完成第一阶段题目的小组可提前进入第二阶段); l 比赛第一阶段的3道题目将在前期宣传中告知参赛选手,比赛第二阶段的题目将由赛事主席当场公布竞赛题目;主席当场公布竞赛题目;l 前两阶段题目分为三个分值(前两阶段题目分为三个分值(55分、分、1010分、分、1515分),第一阶段3道公示题都为5分;第二阶段总共15道题,根据不同的难度分值不同,分别为5道5分题,分题,55道10分题,分题,55道15分题;第一阶段参赛队员不可参考任何相关资料;第二阶段参赛队员可以携带诸如书,如书,手册,程序清单等参考资料。
手册,程序清单等参考资料。
手册,程序清单等参考资料。
比赛过程中队员不得携带任何电子媒质的资料;参比赛过程中队员不得携带任何电子媒质的资料;参赛者可以选择自己擅长的语言(赛者可以选择自己擅长的语言(C,C++,JAVA C,C++,JAVA 等等)进行编写等等)进行编写l 考虑到大一和大二学生的知识掌握程度,大一参加选手一开始就会有10分的分数,最后总分是由所做题目及初始的10分相加得到。
分相加得到。
l 每组队员根据安排使用电脑,小组人数为两人的使用一台电脑,超过两人的使用两台电脑,每台的电脑配置完全相同;脑,每台的电脑配置完全相同;l 各小组每做完一题或几题,必须交予评委老师运行,评委老师当场给分;各小组每做完一题或几题,必须交予评委老师运行,评委老师当场给分; l 如在比赛中发现作弊等行为,将取消比赛资格。
如在比赛中发现作弊等行为,将取消比赛资格。
第一阶段公示题目:题目一:(5分) 打印以下图形,纵遵从字母顺序,行字符数遵从斐波那契数列ABCCDDD EEEEEFFFFFFFFGGGGGGGGGGGGG#include<iostream>int f(int x){int a = 1 , b = 0;int max_ = x;int sum = 0; for(int i = 0; i < max_ ; i++){sum = a + b;a = b;b = sum;}return sum;}void loop_print(int num,char chr){for(int i = 0; i < num ;i++)std::cout<<chr;std::cout<<"\n";}int main(){int line_max = 7;char chr = 'A';for(int line = 0; line < line_max; line++){loop_print(f(line+1),chr);chr++;}return 0;}题目二:(5分)有个电子钟,12点显示为12:00(即12小时制),那么请问一天24时间内,出现连续3个相同数字的钟点有几个?#include<iostream>using namespace std;bool check(int me){int h= me/100;int m= me-100*h;return h<=12&&m<=59&&h>0?true:false;//12小时制小时制}int main(){int me=0;int j(0);//总计数器总计数器while( me<1270){//max 12:59int t= me;int n[4];for(int i=0;i<4;i++){n[i]=t%10;t /= 10;}if(n[1]==n[2]&&(n[0]==n[1]||n[3]==n[1])&&check( me)){//cout<<n[3]<<n[2]<<":"<<n[1]<<n[0]<<"\n";//testj++;me++;}cout<<"total: "<<j*2<<endl;}题目三:(5分)10进制的四位数中有几个符合如下特征:将其分别表示为16进制、10进制、12进制,在每种状态下,分别将各个位上的数相加,能得到3个相等10进制数。
第六届蓝桥杯大赛个人赛省赛(软件类)Java 大学B组试题

第六届蓝桥杯大赛个人赛省赛(软件类)Java 大学B组试题三角形面积如图1所示。
图中的所有小方格面积都是1。
那么,图中的三角形面积应该是多少呢?请填写三角形的面积。
不要填写任何多余内容或说明性文字。
立方变自身观察下面的现象,某个数字的立方,按位累加仍然等于自身。
1^3 = 18^3 = 512 5+1+2=817^3 = 4913 4+9+1+3=17...请你计算包括1,8,17在内,符合这个性质的正整数一共有多少个?请填写该数字,不要填写任何多余的内容或说明性的文字。
三羊献瑞观察下面的加法算式:祥瑞生辉+ 三羊献瑞-------------------三羊生瑞气(如果有对齐问题,可以参看【图1.jpg】)其中,相同的汉字代表相同的数字,不同的汉字代表不同的数字。
请你填写“三羊献瑞”所代表的4位数字(答案唯一),不要填写任何多余内容。
循环节长度两个整数做除法,有时会产生循环小数,其循环部分称为:循环节。
比如,11/13=6=>0.846153846153..... 其循环节为[846153] 共有6位。
下面的方法,可以求出循环节的长度。
请仔细阅读代码,并填写划线部分缺少的代码。
public static int f(int n, int m){n = n % m;V ector v = new V ector();for(;;){v.add(n);n *= 10;n = n % m;if(n==0) return 0;if(v.indexOf(n)>=0)_______System.out.println(v.indexOf(n))__________________________ ; //填空}}注意,只能填写缺少的部分,不要重复抄写已有代码。
不要填写任何多余的文字。
九数组分数1,2,3...9 这九个数字组成一个分数,其值恰好为1/3,如何组法?下面的程序实现了该功能,请填写划线部分缺失的代码。
2015年第六届蓝桥杯软件类省赛真题_C大学C组

for(i=0; i<N; i++){
a[i][0] = 1;
a[i][i] = 1;
}
for(i=1; i<N; i++){
for(j=1; j<i; j++) ___________________________;
}
for(i=0; i<N; i++){
1/2 1/3 1/10 1/15
1/2 1/4 1/5 1/20
1/2 1/4 1/6 1/12
再例如,
输入:
5
程序应该输出:
1/2 1/3 1/12 1/21 1/28
1/2 1/4 1/6 1/21 1/28
1/2 1/4 1/7 1/14 1/28
1/2 1/4 1/8 1/12 1/24
1/2 1/4 1/9 1/12 1/18
for(j=0; j<=i; j++) printf("%-5d", a[i][j]);
printf("\n");
}
return 0;
}
C大学C组
2_题目
1/1 + 1/2 + 1/3 + 1/4 + ... 在数学上称为调和级数。
它是发散的,也就是说,只要加上足够多的项,就可以得到任意大的数字。
但是,它发散的很慢:
前1项和达到 1.0
前4项和才超过 2.0
前83项的和才超过 5.0
那么,请你计算一下,要加多少项,才能使得和达到或超过 15.0 呢?
请填写这个整数。
注意:只需要填写一个整数,不要填写任何多余的内容。比如说明文字。
acm竞赛试题及答案

acm竞赛试题及答案ACM竞赛试题及答案1. 问题描述:给定一个整数数组,找出数组中没有出现的最小的正整数。
2. 输入格式:第一行包含一个整数n,表示数组的长度。
第二行包含n个整数,表示数组的元素。
3. 输出格式:输出一个整数,表示数组中没有出现的最小的正整数。
4. 样例输入:53 4 1 2 55. 样例输出:66. 问题分析:首先,我们需要理解题目要求我们找出数组中缺失的最小正整数。
这意味着我们需要检查数组中的每个元素,并确定最小的正整数是否在数组中。
7. 算法描述:- 遍历数组,使用一个哈希集合记录出现的数字。
- 从1开始,检查每个正整数是否在哈希集合中,直到找到不在集合中的最小正整数。
8. 代码实现:```pythondef find_missing_positive(nums):seen = set()for num in nums:if num <= 0:continuewhile num in seen or num > len(nums):num += 1seen.add(num)return min(set(range(1, len(nums) + 1)) - seen)```9. 测试用例:- 输入:[3, 4, -1, 1]- 输出:210. 答案解析:在给定的测试用例中,数组[3, 4, -1, 1]中没有出现的最小正整数是2。
这是因为-1不是正整数,所以可以忽略。
数组中已经出现了1和3,所以下一个最小的正整数就是2。
11. 注意事项:- 确保数组中的元素是整数。
- 考虑数组中可能包含0或负数的情况。
- 算法的时间复杂度应尽可能低。
12. 扩展思考:- 如果数组非常大,如何优化算法?- 如果数组中的元素可以是浮点数,算法应该如何修改?13. 参考答案:- 针对大数组,可以考虑使用更高效的数据结构,如平衡二叉搜索树。
- 如果元素是浮点数,需要先将其转换为整数,然后再进行处理。
acm编程比赛入门题目集

程序设计比赛试题主办方:迅翔计算机协会最少钱币数:【问题描述】这是一个古老而又经典的问题。
用给定的几种钱币凑成某个钱数,一般而言有多种方式。
例如:给定了6种钱币面值为2、5、10、20、50、100,用来凑15元,可以用5个2元、1个5元,或者3个5元,或者1个5元、1个10元,等等。
显然,最少需要2个钱币才能凑成15元。
你的任务就是,给定若干个互不相同的钱币面值,编程计算,最少需要多少个钱币才能凑成某个给出的钱数。
【要求】【数据输入】输入可以有多个测试用例。
每个测试用例的第一行是待凑的钱数值M(1 <= M <= 2000,整数),接着的一行中,第一个整数K(1 <= K <= 10)表示币种个数,随后是K个互不相同的钱币面值Ki(1 <= Ki <= 1000)。
输入M=0时结束。
【数据输出】每个测试用例输出一行,即凑成钱数值M最少需要的钱币个数。
如果凑钱失败,输出“Impossible”。
你可以假设,每种待凑钱币的数量是无限多的。
【样例输入】156 2 5 10 20 50 10011 2【样例输出】2ImpossibleFeli 的生日礼物【问题描述】Felicia 的生日是11月1日(和Kitty是同一天生的哦)。
于是Feli请来Kitty一起过生日。
Kitty带来了最新款的“Kitty猫”玩具准备送给Feli,不过她说,这份礼物可不是白送的。
Feli要帮她一个忙,才能够得到心仪已久的玩具。
Kitty说,“Kitty猫”玩具已经卖出了n!个,n<=10^100 *_*,Kitty想知道确切的数字,而不是无聊的“一个数加个感叹号”。
Feli听了大吃一惊。
要知道,算出n!是一个无比艰巨的任务。
Feli 告诉Kitty,就算Feli算出n!,Kitty也看不下去,因为当n=20 时,计算机的长整型已经存不下了(Kitty 只能接受1-9之间的数字)。
acm竞赛题库 python版本

acm竞赛题库 python版本
正文:
ACM(Association for Computing Machinery)竞赛是计算机科学领域中的一项著名竞赛,旨在提高学生的算法设计和问题解决能力。
在ACM竞赛中,选手需要通过编写程序来解决一系列的问题。
为了帮助学习Python编程语言的选手,许多ACM竞赛题库都提供了Python版本的题目。
Python是一种简单易学的编程语言,它具有清晰简洁的语法,丰富的库函数和强大的功能。
Python在ACM竞赛中得到了广泛的应用,不仅因为它易于理解和实现,还因为它有很强的算法支持。
许多ACM 竞赛中的题目,比如图论、动态规划和数学问题,都可以用Python 来解决。
ACM竞赛题库的Python版本包含了大量的题目,涵盖了各个难度级别和不同类型的问题。
这些题目可以帮助选手提高他们的编程和算法能力,并且可以帮助他们更好地了解和掌握Python语言的特性和用法。
除了竞赛题库,还有一些在线平台和教程提供了ACM竞赛的Python 解题思路和示例代码。
这些资源可以帮助选手更好地理解问题的解决
方法,并通过实际的编程练习来加深对Python的掌握。
总结来说,ACM竞赛题库的Python版本为学习和掌握Python编程语言的选手提供了一个很好的平台。
通过解决这些题目,选手可以提高他们的算法设计和问题解决能力,并且可以更好地理解和掌握Python 语言的特性和用法。
第六届程序设计比赛题目与答案

三、
问题描述
一种细菌的繁殖速度是每天成倍增长。例如:第一天有10个,第二天就变成20个,第三天变成40个,第四天变成80个,……。现在给出第一天的日期和细菌数目,要你写程序求出到某一天的时候,细菌的数目。
输入数据
第一行有一个整数n,表示测试数据的数目。其后n行每行有5个整数,整数之间用一个空格隔开。第一个数表示第一天的月份,第二个数表示第一天的日期,第三个数表示第一天细菌的数目,第四个数表示要求的那一天的月份,第五个数表示要求的那一天的日期。已知第一天和要求的一天在同一年并且该年不是闰年,要求的一天一定在第一天之后。数据保证要求的一天的细菌数目在整数范围内。
3.{
4.int days[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
5.int n;
6.inti;
7.int sum;
8.int k;
9.long nNum;
10.scanf("%d",&n);
11.for(i = 0;i < n;i ++){
12.int month_1,day_1,month_2,day_2,num;//起止日期的月份和日期。
读入测试样例数n;
做n次:1.读入两个日期及第一天的细菌数;
2.将两个日期转换为当年的第几天;
3.得到两个天数的差,即它们中间间隔的天数m;
4.用第一天的细菌数乘以2的m次方等到x;
5.输出x;
参考程序
参考程序一://作者c061000208013
1.#include <stdio.h>
2.void main( )
参考程序
1.#include <stdio.h>
“浪潮杯”山东省第三届ACM大学生程序设计竞赛赛事细则

“浪潮杯”山东省第三届ACM大学生程序设计竞赛赛事细则比赛环境操作系统:Ubuntu Linux 10.10语言:C/C++(GCC4.4.5),Java(Sun JDK 1.6)编辑器:vi/vim,emacs,gedit桌面环境:GNOMEIDE:Eclipse 3.6 with JDT&CDT,NetBeans,CodeBlocks计算机主要配置:联想启天M700ECPU:Intel Core2 E5300内存:2G硬盘:320G19寸液晶显示器联想标配鼠标键盘JME7053(E),请勿自带键盘鼠标裁判系统:PC^2 9.2.1 对于每次提交,返回下列状态之一:1.YES-OK 该题通过2.No Wrong Answer 答案错误3.No Time-Limit-Exceeded 程序运行超过时限4.No Compile Error 编译错误5.Other Contact Staff 网络软件等比赛环境错误,请联系工作人员特别注意:1.Runtime Error(运行时错误)在本次比赛会被判为Wrong Answer。
2.关于各种错误的判定顺序问题,Compiler Error 先于Time-Limit-Exceeded 先于Wrong Answer。
3.本次比赛无明确的内存限制。
4.Java选手的代码必须使用默认包。
5.评测机与比赛机软硬件配置相同。
比赛纪律:1.禁止带一切电子设备入场,手机关机。
2.允许带纸质资料进场。
3.比赛开始前不允许触碰比赛工作台上的任何物品,比赛开始后不准与除队友和工作人员之外的任何人交流,窥探其他队伍,大声喧哗。
4.不得破坏实验室设施,不得攻击任何选手的计算机以及评测服务器。
5.禁止带食物、水杯入场,不乱扔杂物,保持地面整洁。
6.比赛时要统一着装比赛T-shirt。
7.一切特殊需求请联系工作人员。
山东省计算机学会山东理工大学计算机科学与技术学院2012年4月。
acm程序设计大赛题目

The Mailboxes Manufacturers ProblemTime Limit:1000MS Memory Limit:65536KTotal Submit:299 Accepted:227DescriptionIn the good old days when Swedish children were still allowed to blowup their fingers with fire-crackers, gangs of excited kids would plague certain smaller cities during Easter time, with only one thing in mind: To blow things up. Small boxes were easyto blow up, and thus mailboxes became a popular target. Now, a small mailbox manufacturer is interested in how many fire-crackers his new mailbox prototype can withstand without exploding and has hired you to help him. He will provide you with k(1 ≤ k≤ 10) identical mailbox prototypes each fitting up to m(1 ≤ m≤ 100) crackers. However, he is not sure of how many firecrackers he needs to provide you with in order for you to be able to solve his problem, so he asks you. You think for a while and then say, “Well,if I blow up a mailbox I can’t use it again, so if you would provide me with only k = 1 mailboxes, I would have to start testing with 1 cracker, then 2 crackers, and so on until it finally exploded. In the worst case, that is if it does not blow up ev en when filled with m crackers, I would need 1 + 2 + 3 + … + m = m ×(m+ 1) ⁄ 2 crackers. If m = 100 that would mean more than 5000 fire-crackers!” “That’s too many,” he replies. “What if I give you more than k = 1 mailboxes? Can you find a strategy that requires less crackers?”Can you? And what is the minimum number of crackers that you should ask him to provide you with?You may assume the following:1.If a mailbox can withstand x fire-crackers, it can also withstand x− 1fire-crackers.2.Upon an explosion, a mailbox is either totally destroyed (blown up) orunharmed, which means that it can be reused in another test explosion.Note: If the mailbox can withstand a full load of m fire-crackers, then the manufacturer will of course be satisfied with that answer. But otherwise he is looking for the maximum number of crackers that his mailboxes can withstand.InputThe input starts with a single integer N(1 ≤ N≤ 10) indicating the number of test cases to follow. Each test case is described by a line containing two integers: k and m, separated by a single space.OutputFor each test case print one line with a single integer indicating the minimum number of fire-crackers that is needed, in the worst case, in order to figure out how many crackers the mailbox prototype can withstand.Sample Input41 101 1003 735 100Sample Output555050382495SourceSvenskt Mästerskap i Programmering/Norgesmesterskapet 2002 #include <iostream>using namespace std;const int INF = 1 << 28;int d[11][101][101];int sum(int i, int j) {int ret = 0, k;for (k=i; k<=j; k++) ret += k;return ret;}int max(int a, int b) {return a > b ? a : b;}int main() {int caseTime;int i, j, k, t, K, M, l;scanf("%d", &caseTime);while (caseTime--) {scanf("%d%d", &K, &M);for (i=1; i<=M; i++) {for (j=i; j<=M; j++) {d[1][i][j] = sum(i, j);}}for (k=2; k<=K; k++) {for (l=0; l<M; l++) {for (i=1; i+l<=M; i++) {j = i + l;if (i == j) {d[k][i][j] = i;continue;}d[k][i][j] = INF;for (t=i; t<=j; t++) {int tmp;if (t == i) tmp = d[k][i+1][j];else if (t == j) tmp = d[k-1][i][j-1];else tmp = max(d[k-1][i][t-1], d[k-1][t+1][j]); tmp = max(d[k-1][i][t-1], d[k][t+1][j]);if (d[k][i][j] > t + tmp) d[k][i][j] = t + tmp; }}}}printf("%d\n", d[K][1][M]);}return 0;}Bugs Integrated, Inc.Time Limit:15000MS MemoryLimit:30000KTotal Submit:1180 Accepted:309 Case Time Limit:5000MSDescriptionBugs Integrated, Inc. is a major manufacturer of advanced memory chips. They are launching production of a new six terabyte Q-RAM chip. Each chip consists of six unit squares arranged in a form of a 2*3 rectangle. The way Q-RAM chips are made is such that one takes a rectangular plate of silicon divided into N*M unit squares. Then all squares are tested carefully and the bad ones are marked with a black marker.Finally, the plate of silicon is cut into memory chips. Each chip consists of 2*3 (or 3*2) unit squares. Of course, no chip can contain any bad (marked) squares. It might not be possible to cut the plate so that every good unit square is a part ofsome memory chip. The corporation wants to waste as little good squares as possible. Therefore they would like to know how to cut the plate to make the maximum number of chips possible.TaskYou are given the dimensions of several silicon plates and a list of all bad unit squares for each plate. Your task is to write a program that computes for each plate the maximum number of chips that can be cut out of the plate.InputThe first line of the input file consists of a single integer D (1 <= D <= 5), denoting the number of silicon plates. D blocks follow, each describing one silicon plate. The first line of each block contains three integers N (1 <= N <= 150), M (1 <= M <= 10), K (0 <= K <= MN) separated by single spaces. N is the length of the plate, M is its height and K is the number of bad squares in the plate. The following K lines contain a list of bad squares. Each line consists of two integers x and y (1 <= x <= N, 1 <= y <= M) ?coordinates of one bad square (the upper left square has coordinates [1, 1], the bottom right is [N,M]).OutputFor each plate in the input file output a single line containing the maximum number of memory chips that can be cut out of the plate.Sample Input26 6 51 44 62 23 66 46 5 43 36 16 26 4Sample Output34SourceCEOI 2002CODE:#include <iostream>using namespace std;int g[150][10], blk[10];int d[4][60000];int e[11] = {1, 3, 9, 27, 81, 243, 729, 2187, 6561, 19683, 59049};int n, m, kn;int can1, can2, b[10][60000];int *l0, *l1, *l2, *l3, *bit0, *bit1, *bit2;void build() {int i, j, tmp;for (i=0; i<e[10]; i++) {j = 0; tmp = i;while (tmp > 0) {b[j][i] = tmp % 3;tmp /= 3;j++;}}}inline int maxt(int a, int b) {return a > b ? a : b;}void solve() {int i, j, k, x, y, a1, a2, p, c;scanf("%d%d%d", &n, &m, &kn);memset(g, 0, sizeof(g));memset(d, 0, sizeof(d));for (i=0; i<kn; i++) {scanf("%d%d", &x, &y);g[x-1][y-1] = 1;}for (i=0; i<m; i++) blk[i] = 1 - g[0][i];for (i=1, c=2; i<n; i++) {for (j=0; j<m; j++) {if (g[i][j]) blk[j] = 0;else blk[j]++;c = (c+1)%4;can1 = (j>0 && blk[j]>2 && blk[j-1]>2);can2 = (j>1 && blk[j]>1 && blk[j-1]>1 && blk[j-2]>1);a1 = 2*e[j]+2*e[j-1];a2 = e[j]+e[j-1]+e[j-2];l0 = d[c]; l1 = d[(c+3)%4]; l2 = d[(c+2)%4]; l3 = d[(c+1)%4];bit0 = b[j];if (j>0) bit1 = b[j-1];if (j>1) bit2 = b[j-2];for (p=0; p<e[m]; p++) {if (bit0[p]) {l0[p] = l1[p-e[j]];} else {l0[p] = l1[p];if (j>0 && !bit1[p]) {if (can1) l0[p] = maxt(l0[p],l2[p+a1]+1);if (can2 && !bit2[p]) l0[p] = maxt(l0[p], l3[p+a2]+1); }}}}}printf("%d\n", d[c][0]);}int main() {build();int caseTime;scanf("%d", &caseTime);while (caseTime--) {solve();}return 0;}Silver Cow PartyTime Limit:2000MS MemoryLimit:65536KTotal Submit:1112 Accepted:326 DescriptionOne cow from each of N farms (1 ≤ N≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X(1 ≤ X≤ N). A total of M (1 ≤ M≤ 100,000) unidirectional (one-way roads connects pairs of farms; road i requires T i(1 ≤ T i≤ 100) units of time to traverse.Each cow must walk to the party and, when the party is over, return to her farm. Each cow is lazy and thus picks an optimal route with the shortest time. A cow's return route might be different from her original route to the party since roads are one-way.Of all the cows, what is the longest amount of time a cow must spend walking to the party and back?Line 1: Three space-separated integers, respectively: N, M, and XLines 2..M+1: Line i+1 describes road i with three space-separated integers: A i, B i, and T i. The described road runs from farm A i to farm B i, requiring T i time units to traverse.OutputLine 1: One integer: the maximum of time any one cow must walk.Sample Input4 8 21 2 41 3 21 4 72 1 12 3 53 1 23 4 44 2 3Sample Output10HintCow 4 proceeds directly to the party (3 units) and returns via farms 1 and 3 (7 units), for a total of 10 time units.USACO 2007 February Silver#include <iostream>using namespace std;const int INF = 1 << 28;int adj[1001][1001], adjw[1001][1001], na[1001];int n, m, x;//heap sink,swim,getmin,insert参数均为外部编号,wt为其权值int heap[100001], id[100001], hsize;int *key;void init(int s, int *wt) {int i;hsize = s;key = wt;for (i=1; i<=hsize; i++) {heap[i] = i;id[i] = i;}}void swim(int u) {int p = id[u], q = p >> 1, ku = key[u];while (q && ku < key[heap[q]]) {id[heap[q]] = p;heap[p] = heap[q];p = q;q = p >> 1;}id[u] = p;heap[p] = u;}void sink(int u) {int p = id[u],q = p << 1, ku = key[u];while (q <= hsize) {if (q < hsize && key[heap[q+1]] < key[heap[q]]) q++;if (key[heap[q]] >= ku) break;id[heap[q]] = p;heap[p] = heap[q];p = q;q = p << 1;}id[u] = p;heap[p] = u;}int getmin() {int ret = heap[1];id[ret] = -1;id[heap[hsize]] = 1;heap[1] = heap[hsize];hsize--;sink(heap[1]);return ret;}void insert(int u) {heap[++hsize] = u;id[u] = hsize;swim(u);}void build() {int i;for (i=hsize/2; i>0; i--) sink(heap[i]); }bool isEmpty() {return hsize == 0;}int dijkstraHeap(int beg, int end=-1) {int i, j, k, u, v, w;int dist[1001], chk[1001];for (i=1; i<=n; i++) {dist[i] = INF;chk[i] = 0;}init(n, dist);dist[beg] = 0; swim(beg);while (!isEmpty()) {u = getmin();if (u == end) break;chk[u] = 1;for (i=0; i<na[u]; i++) {v = adj[u][i];w = adjw[u][i];if (dist[v] > dist[u] + w) { dist[v] = dist[u] + w;swim(v);}}}if (end == -1) return dist[n];return dist[end];}int main() {int i, j, k, u, v, w;int val[1001];scanf("%d%d%d", &n, &m, &x);for (i=0; i<m; i++) {scanf("%d%d%d", &u, &v, &w);adj[u][na[u]] = v;adjw[u][na[u]] = w;na[u]++;}dijkstraHeap(x);memcpy(val, key, sizeof(val));int ans = 0;for (i=1; i<=n; i++) {int tmp = dijkstraHeap(i,x);if (tmp+val[i] > ans) ans = tmp + val[i]; }printf("%d\n", ans);return 0;}。
2015年孙越崎科技教育基金优秀学生奖推荐表

智育成绩排名第三,综合测评排名第二,2次校二等奖学金,1次校一等奖学金;获得优秀共青团员、优秀学生标兵、大学生暑期三下乡社会实践优秀学生等荣誉称号。获得材料之星实验技能大赛优秀奖、挑战杯校一等奖等。
24
交通学院
车辆工程2013-2班
范卫红
女
1995年12月
共青团员
担任学院新闻中心副主任和校记者团网编部干事,学习成绩位于班级前列,综合测评排名第四,连续三个学期获得学校二等奖学金;获得优秀团员、优秀学生编辑荣誉称号;英语水平较高,以优秀成绩通过大学英语四级考试,并在学校举办的“英语风采大赛”中获得三等奖。
27
艺术学院
工业设计2012-2班
林佐洁
女
1992年10月
中共预备党员
现任团支部书记和院办公室主任,综合测评排名前三名,多次获得校一等奖学金,大学英语四级成绩447分;多次获得优秀团干部、优秀团员等荣誉称号。
28
泰安校区信息工程系
计算机科学与技术
2012-2班
孙月驰
男
1990年6月
中共党员
现任山东科技大学泰安校区学生会主席,2014至2015年上学期综合测评成绩在班内第一,顺利通过国家英语四级考试。多次获得一等、二等奖学金;荣获优秀团干部、三好学生等荣誉称号;在大学生暑期“三下乡”社会实践中连续两年被评为“优秀学生”称号,2014年5月被共青团泰安市委授予“泰安市优秀共青团员”称号,2015年5月被评为“优秀团支部书记”。
15
经管学院
会计学2012-3
郭文静
女
1994年1月
中共预备党员
担任班级团支书,综合测评成绩每学年均列班级前三名。获得三好学生、优秀共青团员荣誉称号;多次获得校奖学金,获得兴建奖学金。获得沙盘模拟大赛省级三等奖国家级三等奖、挑战杯大赛省级二等奖、获得节能减排大赛校级二等奖。获得国家实用新型专利1项、三下乡实践活动获得省级优秀个人。
第六届蓝桥杯JavaC组省赛真题——详细答案对照(包含垒骰子)

第六届蓝桥杯JavaC组省赛真题——详细答案对照(包含垒骰⼦)A、隔⾏变⾊Excel表的格⼦很多,为了避免把某⾏的数据和相邻⾏混淆,可以采⽤隔⾏变⾊的样式。
⼩明设计的样式为:第1⾏蓝⾊,第2⾏⽩⾊,第3⾏蓝⾊,第4⾏⽩⾊,....现在⼩明想知道,从第21⾏到第50⾏⼀共包含了多少个蓝⾊的⾏。
请你直接提交这个整数,千万不要填写任何多余的内容。
题解:package demo;public class demo {public static void main(String[] args) {int color = 0;for (int i = 21; i <= 50; i++) {if (i % 2 != 0) {color++;}}System.out.println(color);}}B、⽴⽅尾不变有些数字的⽴⽅的末尾正好是该数字本⾝。
⽐如:1,4,5,6,9,24,25,....请你计算⼀下,在10000以内的数字中(指该数字,并⾮它⽴⽅后的数值),符合这个特征的正整数⼀共有多少个。
请提交该整数,不要填写任何多余的内容。
题解:int count = 0;for (int i = 1; i <= 10000; i++) {String x = i + "";String cudb = cudb(i) + "";// 切割⽴⽅数最后相应⼏位String y = cudb.substring(cudb.length() - x.length());// 判断是否相同if (y.equals(x)) {count++;}}System.out.println(count);}/*** @param x* @return*/public static long cudb(int x) {return (long)Math.pow(x, 3);}}C、⽆穷分数⽆穷的分数,有时会趋向于固定的数字。
算法笔记_214:第六届蓝桥杯软件类校赛真题(Java语言A组)

算法笔记_214:第六届蓝桥杯软件类校赛真题(Java语⾔A组)⽬录前⾔:以下代码仅供参考,若有错误欢迎指正哦~1 题⽬⼀⼀个串的⼦串是指该串的⼀个连续的局部。
如果不要求连续,则可称为它的⼦序列。
⽐如对串: "abcdefg" ⽽⾔,"ab","abd","bdef" 等都是它的⼦序列。
特别地,⼀个串本⾝,以及空串也是它的⼦序列。
对两个串⽽⾔,可以有许多的共同的⼦序列,我们关⼼的是:它们所共同拥有的长度最⼤的⼦序列是多长。
以下代码实现了这个问题的求解。
请填写划线部分缺失的代码。
注意:只填写缺少的代码,不要写任何多余的内容,⽐如注释或说明⽂字。
public class Zixulie{public static int f(String x, String y){if(x.length()==0) return 0;if(y.length()==0) return 0;String x1 = x.substring(1);String y1 = y.substring(1);if(x.charAt(0)==y.charAt(0)) return f(x1,y1)+1;return __________________________;}public static void main(String[] args){System.out.println(f("ac","abcd")); //2System.out.println(f("acebbcde1133","xya33bc11de")); //5}}答案:Math.max(f(x, y1),f(x1, y))2 题⽬⼆历史上有许多计算圆周率pai的公式,其中,格雷⼽⾥和莱布尼茨发现了下⾯的公式:pai = 4*(1-1/3+1/5-1/7 ....)参见【图1.png】这个公式简单⽽优美,但美中不⾜,它收敛的太慢了。
第十三届山东icpc题解

第十三届山东ICPC题解2019年11月24日,第十三届山东省大学生程序设计竞赛(ICPC)在山东科技大学圆满落幕。
本次比赛共吸引了来自全省各高校的60支队伍参赛,考验了参赛队伍在算法和编程方面的能力。
以下是本次比赛的题目解析。
题目一:最大的数题目描述给定一个整数数组,你需要找到其中最大的数,并输出后缀为K位的最大数。
输入格式第一行输入一个整数N表示数组的长度。
第二行输入N个整数分别表示数组中的元素。
第三行输入一个整数K表示后缀的位数。
输出格式输出一个整数,表示后缀为K位的最大数。
样例输入51 2 3 4 52样例输出45解题思路我们可以遍历整个数组,将数组中的元素转换为字符串后截取后缀为K位的子字符串。
然后依次比较截取后的子字符串大小,找到最大的那个子字符串即可。
题目二:最小的字典序题目描述给定一个字符串S和一个整数K,你需要找到长度为K且字典序最小的子串。
输入格式第一行输入一个字符串S。
第二行输入一个整数K。
输出格式输出一个字符串,表示长度为K且字典序最小的子串。
样例输入banana3样例输出ana解题思路我们可以使用滑动窗口的思想来解决这个问题。
我们首先将窗口的左边界和右边界都设置为字符串的起始位置,然后我们逐步向右滑动窗口,检查窗口内的字符是否满足题目要求。
如果满足,我们记录当前窗口内的子串,并与之前记录的子串进行比较,更新最小字典序的子串。
最后,我们输出最小字典序的子串即可。
题目三:最小公倍数之和题目描述给定一个正整数N,求1到N之间所有数字的最小公倍数之和。
输入格式输入一个整数N。
输出格式输出一个整数,表示1到N之间所有数字的最小公倍数之和。
样例输入5样例输出60解题思路我们知道,两个数的最小公倍数等于它们之积除以它们的最大公约数。
因此,我们可以使用一个循环依次计算出1到N之间所有数字的最大公约数,并将最大公约数依次累加到结果中。
最后,我们返回结果即可。
总结本次第十三届山东ICPC题目涵盖了不同类型的题目,考验了参赛队伍在算法和编程方面的能力。
ACM程序大赛选拔初赛试题 - 参考答案

a[n]=n+1; int x=0; while(n>=1) {
if(a[i]!=0) {
if(x%2==0) { if(n==2) printf("\n"); printf("%d ",a[i]); n--; a[i]=0; } x++; } if(i+1>=size) i=0; else i++; } }
4、解方程 难度系数:★★☆☆☆
(注意此题只供 10 级的同学,08,09 级的同学请做第三题) 题意:形如 ax2+bx+c=d 的方程。其中 a,c,d 均为整数,b 为正整数。请你用计算机求出对 应的 x 的值(只考虑实数根)。
输入:依次输入 a,b,c,d 的值。注意:只要输入一组数据。用空格隔开。
char temp,str[10]; scanf("%s",str);
for(int i=0;i<9;i++) for(int j=i+1;j<10;j++) if(str[i]>str[j]) { temp=str[i]; str[i]=str[j]; str[j]=temp; }
cout<<str<<endl; }
输入:依次输入函数的四个系数中的 a,b,c,d 的值。用空格隔开。
输出:如果有极值点则全部输出,结果保留两位小数,格式为“(x1=#,y1=#) (x2=#,y2=#)”,如果没有则输入“no answer。
Pickapples(大范围贪心,小范围完全背包)

Pickapples(⼤范围贪⼼,⼩范围完全背包)Pick applesTime Limit: 1000MS Memory Limit: 165536KBProblem DescriptionOnce 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 apple has a size and a price to be sold. Now the little girl wants to gain more profits, but she does not know how. So she asks you for help, and tell she the most profits she can gain.InputIn the first line there is an integer T (T <= 50), indicates the number of test cases.In each case, there are four lines. In the first three lines, there are two integers S and P in each line, which indicates the size (1 <= S <= 100) and the price (1 <= P <= 10000) of this kind of apple.In the fourth line there is an integer V,(1 <= V <= 100,000,000)indicates the volume of the girl's bag.OutputFor each case, first output the case number then follow the most profits she can gain.Example Input11 12 13 16Example OutputCase 1: 6HintAuthor2012年"浪潮杯"⼭东省第三届ACM⼤学⽣程序设计竞赛/** @Author: lyuc* @Date: 2017-04-27 16:06:19* @Last Modified by: lyuc* @Last Modified time: 2017-04-27 19:27:24*/#include <iostream>#include <stdio.h>#include <string.h>#include <algorithm>#define LL long long#define maxn 1000000using namespace std;struct node{int s,p;bool operator <(const node & other) const {return p*1.0/s>other.p*1.0/other.s;}}fr[4];LL dp[1000005];int t;int v;LL res;int main(){// freopen("in.txt","r",stdin);scanf("%d",&t);for(int ca=1;ca<=t;ca++){printf("Case %d: ",ca);res=0;memset(dp,0,sizeof dp);for(int i=0;i<3;i++){scanf("%d%d",&fr[i].s,&fr[i].p);}scanf("%d",&v);if(v<=maxn){for(int i=0;i<3;i++){for(int j=fr[i].s;j<=v;j++){dp[j]=max(dp[j],dp[j-fr[i].s]+fr[i].p); }}printf("%lld\n",dp[v]);}else{sort(fr,fr+3);while(v>maxn){res+=fr[0].p;v-=fr[0].s;}for(int i=0;i<3;i++){for(int j=fr[i].s;j<=v;j++){dp[j]=max(dp[j],dp[j-fr[i].s]+fr[i].p); }}printf("%lld\n",res+dp[v]);}}return0;}。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Problem Set
May 10, 2015
This problem set should contain twelve (12) problems on fifteen (15) pages. Please inform a runner immediately if something is missing from your problem set.
2
2 3 b2 b2 q 12 b2 b2 b3 b3 q b4 q c4 c3 q c2 q
Sample Output
none none 4 3 2
3
Problem C. Game!
Description
One day, zbybr is playing a game with blankcqk, here are the rules of the game: There is a circle of N stones, zbybr and blankcqk take turns taking the stones. Each time, one player can choose to take one stone or take two adjacent stones. You should notice that if there are 4 stones, and zbybr takes the 2nd, the 1st and 3rd stones are still not adjacent. The winner is the one who takes the last stone. Now, the game begins and zbybr moves first. If both of them will play with the best strategy, can you tell me who will win the game?
Each of the next N lines contains two real numbers X and Y, representing the height and weight of a friend respectively.
Output
One line for each test case. If the red team is more likely to win, output "red", if the blue team is more likely to win, output "blue". If both teams have the same weight, output "fair".
Problem A. Nias and Tug-of-War
Description
Nias is fond of tug-of-war. One day, he organized a tug-of-war game and invited a group of friends to take part in.
Output
Output the name of the winner.
Sample Input
2 1 2
Sample Output
zbybr zbybr
4
Problem D. Stars
Description
There are N (1 ≤ N ≤ 400) stars in the sky. And each of them has a unique coordinate (x, y) (1 ≤ x, y ≤ N). Please calculate the minimum area of the rectangle (the edges of the rectangle must be parallel to the X, Y axes) that can cover at least K (1 ≤ K ≤ N) stars. The stars on the borders of the rectangle should not be counted, and the length of each rectangle’s edge should be an integer.
Input
The first line of input contains an integer T, indicating the number of test cases (T ≤ 60). Each test case begins with a integer N (1 ≤ N ≤ 200000) indicating the number of operations. Next N lines each represents an operation. There are three kinds of operations: "b x": x (1 ≤ x ≤ 106) is an integer, this means a customer bids at price x. "c x": a customer has canceled his bid at price x. "q" : means "Query". You should print the current lowest unique price. Our customers are honest, they won't cancel the price they didn't bid at.
OutputFor eFra bibliotekch test case, output the answer on a single line.
Sample Input
2 11 11 22 11 12
Sample Output
1 2
5
Problem E. BIGZHUGOD and His Friends I
Description
BIGZHUGOD and his three friends feel bored at home, then they decide to play a game called "niuniu". The rules of "niuniu" are: first randomly pick 5 cards from all cards, then divide them into 2 groups, one group has 2 cards, and the other has 3 cards. If the sum of both groups are multiples of 10, then they are "niuniu". Moreover, A counts for 1, J, Q, K, black joker and red joker counts for 10. BIGZHUGOD has an incomplete pack of card. And his three friends let BIGZHUGOD pick up 5 cards randomly, if they are "niuniu", BIGZHUGOD will gain meals from friends. Now BIGZHUGOD knows the number of every kind of card, he wants to know the possibility that he can gain the meal.
Input
The first line of input contains an integer T, indicating the number of test cases (T≈100000). For each case, there is a positive integer N (N ≤ 1018).
We know that the team which has a larger sum of weight has advantages in the tug-of-war. Now give you the guys' heights and weights, please tell us which team has advantages.
Output
Please print the current lowest unique price for every query ("q"). Print "none" (without quotes) if there is no lowest unique price.
Sample Input
Sample Input
1 6 170 55 165.3 52.5 180.2 60.3 173.3 62.3 175 57 162.2 50
Sample Output
blue
1
Problem B. Lowest Unique Price
Description
Recently my buddies and I came across an idea! We want to build a website to sell things in a new way. For each product, everyone could bid at a price, or cancel his previous bid, finally we sale the product to the one who offered the "lowest unique price". The lowest unique price is defined to be the lowest price that was called only once. So we need a program to find the "lowest unique price", We'd like to write a program to process the customers' bids and answer the query of what's the current lowest unique price. All what we need now is merely a programmer. We will give you an "Accepted" as long as you help us to write the program.