Problem: A

Time limit: 1s    Mem limit: 64 MB    AC/Submission: 0/0    Discuss

Back   Ranklist  Status  Pending: NaN天 NaN时 NaN分 NaN秒

Problem Description
A famous ACMer named LIST.He is very rich,so he has infinite coins of some par value(面值).One day he has a list of things he want

to buy.And he is so rich,he can buy a things for many ways.for example,if he want to spend 5 yuan to buy a things,he will give the seller five coins (1,1,1,1,1) or three coins (2,2,1) or two coins (3,2) and so on.Now he wants to ask you to help him calculate how many ways he can pay m yuan.

Input
In the first line is a number T means the amount of cases(T<=50).And in each case,the first line has two numbers ,n(the amount of the par value, n<=30) and m(the sum of money LIST has to spend, m<=150).

In the next line has n numbers mean the different par value(each par value is no more than 35).

Output
Each case output one line,like"Case #i: Ai"(i is the number of case and Ai is the number of ways in this case).

Ai might be big,but it can't be very big.

Sample Input
1
5 13
1 2 3 5 10

Sample Output
Case #1: 37

Source
分析:第一次敲的时候是多重背包,但是存在每一个硬币面额是没有限制的个数。最后小灰灰找到思路,说不是多重背包,是递归。最后服务器炸了,没有能提交上。

 #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int sum;
int a[];
int b[][];
int c[] = { };
int max = ;
int m;
void digui(int money, int n)
{
int j, k, flag = ;
if (money == )
{
sum++;
return;
}
if (money <)
{
return;
}
for (j = n;j >= ;j--)
{
digui(money - a[j], j);
}
}
int main(void)
{
int t, i, n, m, j;
while (scanf("%d", &t) != EOF)
{
for (i = ;i < t;i++)
{
sum = ;
scanf("%d%d", &n, &m);
for (j = ;j < n;j++)
{
scanf("%d", &a[j]);
}
digui(m, n-);
printf("Case #%d:%d\n",i+, sum);
}
}
}

Problem: B

Time limit: 1s    Mem limit: 64 MB    AC/Submission: 0/0    Discuss

Back   Ranklist  Status  Pending: NaN天 NaN时 NaN分 NaN秒

Problem Description
十滴水是一款益智小游戏。

[图片链接在最下方]

如上图所示,每一个方格内可能存在水滴或者为空,水滴的状态可能为1级水滴,2级水滴,3级水滴,4级水滴,你现在有若干1级水滴,当1级水滴滴在空白处,则空白处状态变为1级水滴,当1级水滴滴在其他水滴上时,使其等级+1,若水滴等级达到5以后会炸裂,向周围4个方向按照上左下右的顺序依次各发射一个1级水滴,1级水滴会沿着初始炸裂方向前进,直到遇到水滴(沿途不会在空白处停下),水滴出界则视为消失。

现在有一个n*m的图,图中有若干等级已知的水滴,调皮的ACMER有k个1级水滴,将依次滴在相应的坐标,滴入第一滴后当图不再发生变化后滴入第二滴,以此类推,请你将最后的图的状态输出。

当然,为了让水滴有序的炸裂,我们规定,当一滴水炸裂出的四个水滴的往上的那个水滴碰到水滴或者出界后,第二个水滴才会向左开始运动,以此类推。并且,当一滴水炸裂以后的水滴引起了新的水滴达到等级5,这个新的等级5的水滴会在刚才这个水滴的4个子水滴都出界或者遇到水滴以后再开始炸裂,并且四个子水滴引起的其他水滴的炸裂顺序按照上方的水滴引起的若干其他水滴的炸裂,然后再是左方水滴,以此类推,详细的请看提示。

提示:

如图是样例1的过程,红色加粗的水滴代表已经达到5级的水滴但还没爆裂,(为了方便……后面的图中#号不再表示)按照上述规定,水滴依次炸裂。(当这个水滴已经是五级水滴但还未炸裂时,如图中红色加粗的水滴,他们将被看做是空白区域)

http://202.118.31.226/image/Hint.png

Input
输入有多组测试数据,在输入数据的第一行为测试数据组数T(1<=T<=20)。

对于每一组测试数据,第一行为三个整数n,m,k,代表图的长,宽和水滴数量(3<=n,m<=32,1<=k<=10)

接下来的n行,每行有m个字符,代表图的状态。(“#”字符代表边界)

接下来的k行,每行两个元素,Xi,Yi,代表滴下水滴的坐标位置。(Xi是第i行,Yi是第i列,左上角的#是第0行第0列)

Output
对于第i组数据,第一行先输出”Case #i:”,然后接下来n行输出图的最终状态。每个样例之后空一行。

Sample Input
2
5 6 1
######
#2343#
#2444#
#2342#
######
2 3
6 6 2
######
#0000#
#4430#
#1120#
#0004#
######
2 2
4 4

Sample Output
Case #1:
######
#4000#
#4000#
#4000#
######

Case #2:
######
#0000#
#0000#
#2230#
#0000#
######

Source

Hint
No Hint!

这题是涂涂做的

 #include<stdio.h>
#include<string.h> char maps[][];
int movee[][]={{-,},{,-},{,},{,}};
int k[][];
int zhan[][], head=,tile=; void zhan_pop(int x, int y)
{
zhan[tile][] = x;
zhan[tile][] = y;
tile ++;
return;
} int if_null()
{
if(head == tile) return ;
else return ;
} void pop_fwater(int x, int y)
{
if(maps[x][y] == '') maps[x][y] ='';
zhan_pop(x,y);
return;
} void give_water(int x, int y, int s)
{
if(maps[x][y] == '') {
give_water(x+movee[s][], y+movee[s][], s);
return;
}
else if(maps[x][y] == '#') return;
else {
maps[x][y] ++;
if(maps[x][y] == '') {
maps[x][y] = '';
zhan_pop(x, y);
}
return;
}
}
int main()
{
int a;
while(scanf("%d", &a)!=EOF){
for(int i=;i<a;i++){
int n, m, kk;
scanf("%d%d%d", &n, &m, &kk);
for(int x=;x<n;x++){
scanf("%s",maps[x]);
}
for(int x=;x<kk;x++)scanf("%d%d", &k[x][], &k[x][]);
for(int x=;x<kk;x++){
int xx=k[x][],yy=k[x][];
maps[xx][yy]++;
if(maps[xx][yy] == '') pop_fwater(xx,yy);
while(!if_null()){
xx=zhan[head][];
yy=zhan[head][];
for(int j=;j<;j++)
give_water(xx+movee[j][], yy+movee[j][], j);
head++;
}
}
printf("Case #%d:\n", i+);
for(int x=;x<n;x++) printf("%s\n", maps[x]);
}
}
return ;
}

Problem: F

Time limit: 1s    Mem limit: 64 MB    AC/Submission: 0/0    Discuss

Back   Ranklist  Status  Pending: NaN天 NaN时 NaN分 NaN秒

Problem Description
来来来,做道题,一起防老年痴呆。啤酒2元一瓶,4个瓶盖换一瓶,2个空瓶换一瓶。问:n元可换几瓶。不可以赊账不可以买半瓶酒.

Input
多组数据,输入文件第一行是一个整数T,接下来T行,每行一个整数n(0<=n<=10000000)

Output
问最多能够得到多少瓶啤酒

Sample Input
2
0
10

Sample Output
0
15

Source

Hint
No Hint!

Submit
思路:水题

 #include<stdio.h>

 int main()
{
int a;
while(scanf("%d", &a)!=EOF){
for(int i=;i<a;i++){
int n;
scanf("%d", &n);
n /= ;
int ping=n,gai=n;
while(ping>= || gai>=){
int neww=;
neww += ping/;
neww += gai/;
ping = ping% +neww;
gai = gai% +neww;
n += neww;
}
printf("%d\n",n);
}
} return ;
}

Problem: G

Time limit: 1s    Mem limit: 835.3125 MB    AC/Submission: 0/0    Discuss

Back   Ranklist  Status  Pending: NaN天 NaN时 NaN分 NaN秒

Problem Description
有两个字符串,比如:abedc与acbde,它们公共的序列有许多种,这个序列在原串中可以是不连续的,比如ab,ad,abe,e等都可算做他们的公共序列,但是最长的序列为abe,长度为3,那么怎么求出这个序列最长是多少呢?

Input
第一行是一个整数T,代表多少组数据(T<=15)

每组数据给出两个字符串(由小写字符组成),长度都小于5000

Output
按题意输出一个整数

Sample Input
2
abcde
edcba
abedc
acbde

Sample Output
1
3

Source

Hint
No Hint!
思路:求最长公共子序列长度

 #include <iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int dp[][];
char s1[],s2[]; int LCS(int len1,int len2)
{
memset(dp,,sizeof(dp));
for(int i=;i<=len1;i++)
for(int j=;j<=len2;j++)
{
if(s1[i-]==s2[j-])
dp[i][j]=dp[i-][j-]+;
else
dp[i][j]=dp[i-][j]>dp[i][j-]?dp[i-][j]:dp[i][j-];
}
return dp[len1][len2];
}
int main()
{
int len1,len2;
int T;
scanf("%d",&T);
while(T--)
{
scanf("%s%s",s1,s2);
{
len1=strlen(s1);
len2=strlen(s2);
printf("%d\n",LCS(len1,len2));
}
}
return ;
}

一共做出4道题,提交AC了3道,一道服务器在还有半个小时时候已经挂了,没法提交。

ACM-东北大学程序设计竞赛-网络赛(2016.04.16)的更多相关文章

  1. ACM-南京理工大学第八届程序设计竞赛-网络赛(2016.04.17)

    A.偷吃糖果Time Limit: 1000Ms Memory Limit: 65536KB Description小鱼喜欢吃糖果.他有两盒糖果,两盒糖果分别仅由小写字母组成的字符串s和字符串t构成. ...

  2. 2018CCPC 中国大学生程序设计竞赛 网络赛

    链接 1.括号序列贪心/CF&51nod原题 [分析]: 贪心,每次到i的时候,假如你要在i里面要卖掉股票,获益是a[i], 肯定要在前面要么:1)把已经卖了的变成不买不卖,需要-a[j], ...

  3. “浪潮杯”第九届山东省ACM大学生程序设计竞赛重现赛 C-Cities

    题目描述:There are n cities in Byteland, and the ith city has a value ai. The cost of building a bidirec ...

  4. 2016中国大学生程序设计竞赛 - 网络选拔赛 C. Magic boy Bi Luo with his excited tree

    Magic boy Bi Luo with his excited tree Problem Description Bi Luo is a magic boy, he also has a migi ...

  5. 电子科技大学第八届ACM趣味程序设计竞赛第四场(正式赛)题解

    A. Picking&Dancing 有一列n个石子,两人交替取石子,每次只能取连续的两个,取走后,剩下的石子仍然排成1列.问最后剩下的石子数量是奇数还是偶数. 读懂题意就没什么好说的. #i ...

  6. [2012山东省第三届ACM大学生程序设计竞赛]——n a^o7 !

    n a^o7 ! 题目:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2413 Time Lim ...

  7. 第八届山东省ACM大学生程序设计竞赛个人总结

    因为省赛,从开学紧张到5月7号.心思也几乎全放在ACM的训练上.因为我还是校台球协会的会长,所以台协还有一些事情需要忙,但是我都给延迟了.老会长一直在催我办校赛,但我一直说 等等吧,因为校赛只能在周六 ...

  8. 2018中国大学生程序设计竞赛 - 网络选拔赛 1001 - Buy and Resell 【优先队列维护最小堆+贪心】

    题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6438 Buy and Resell Time Limit: 2000/1000 MS (Java/O ...

  9. 2018中国大学生程序设计竞赛 - 网络选拔赛 1010 YJJ's Salesman 【离散化+树状数组维护区间最大值】

    题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6447 YJJ's Salesman Time Limit: 4000/2000 MS (Java/O ...

随机推荐

  1. LabVIEW 吸星大法 - 看见的好东西都是我的(下篇)

    前言 写了多年的LabVIEW程序,你是否面临这样的问题 总是在做一些重复的工作,感觉很没有意思: 总在不停的写代码,做类似的控件,实现相同的功能,丝毫没有成就感: 总在天加班,没有时间去提高自己; ...

  2. 执行mysqld_safe报错:mysqld does not exist or is not executable

    执行mysqld_safe报错: [root@edu data]# /usr/local/mysql5.7/bin/mysqld_safe --user=mysql160427 12:41:28 my ...

  3. solr使用语法笔记

    http://127.0.0.1:8095/shangbiao_sale/select?sort=id+desc&fq=&wt=json&json.nl=map&q=s ...

  4. JS 怎么控制某个div的滚动条滚动到顶部? (已解决)

    获取这个元素,然后设置它的滚动条的位置为初始位置(0,0). document.getElementById(..).scrollTop = 0;

  5. 华为oj 购物单

    这两天断断续续敲完这个(放假的时候比较懒),一次成功有点小激动(●'◡'●)  不过貌似从第一次打开开始计时..... 这道题目很像01背包,我将附件与它们的主件绑定(就是link起来)然后套用动态规 ...

  6. 基于struts2和hibernate的分页实现

    在拜读了各位大牛的博客后,加以修改和添加总算是借鉴出了一个可行的分页实现.(●'◡'●) 话不多说,先贴两张效果图吧 接下来是实现代码: pagingDAOImpl.java public class ...

  7. 什么是XA事务

    什么是XA事务 分布式事务处理是指一个事务可能涉及多个数据库操作分布式事务处理的关键是必须有一种方法可以知道事务在任何地方所做的所有动作,提交或回滚事务必须产生一致的结果(全部提交或全部回滚). XA ...

  8. 混搭.NET技术

    新闻 .NET技术+25台服务器怎样支撑世界第54大网站 再度燃起人们对.NET的技术热情.这篇新闻中透露了StackExchange 在技术方面的混搭,这也是我所崇尚的.因此我也在社区里极力推广Mo ...

  9. Event Store 2.0发布,带来了安全支持和测试版Projections库

    Event Store 2.0版本于上周发布,它带来了安全支持允许锁定Event Store和在事件流上设置访问控制列表.其主要新特性包括: HTTP和TCP之上的身份认证,包括账户管理 测试版Pro ...

  10. node如何让一个端口同时支持https与http

    众所周知node是一个高性能的web服务器,使用它可以很简单的创建一个http或https的服务器. 比如一个很简单的http服务器: var http = require('http'); var ...