acm_icpc网络赛第一站:牡丹江赛区

sad没想到自己菜成这个样子,虽然第一次打组队赛,本来也没指望出线什么的,结果3人鼓捣了半天除了两个水题,A题太水不说了,一般都是5分钟内解决,最快的好像是2分钟。。神手速orz,a题是chp敲的1A,然后他就去做了c题,后来用记录路径的bfs搜了几次都TLE了,后来c题也不了了之了,然后看到J题过了一大片,果断枚举水过,wa了5次。。在之后我敲了H题,TLE。。sad 纯暴力算法果然不行。。事后学长说是记忆化搜索?反正整个实验室都没出来H题好像。。

A题:

The Himalayas


Time Limit: 2 Seconds      Memory Limit: 65536 KB



As an artist, Bob usually need to travel around the world. He made a lot of sketch of scenery on his journey. A famous spot he have visited recently is the Himalayas. The Himalayas is
a mountain range in South Asia separating the plains of the Indian subcontinent from the Qinghai-Tibet Plateau. The Himalayas include over a hundred mountains exceeding 7,200 meters in elevation.

One day, Bob came up with an strange idea. He wanted to know the number of mountain peaks in his paintings. As his best friend, he turned to you for help. You are given a list of N height
sampling values Hi. You should determine how many peaks are there. For all i which satisfies 2 <= i <= N - 1, Hi is defined as a peak if and only if Hi-1 < Hi > Hi+1.

Input

There are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:

The first line contains one integer N (1 <= N <= 50). The next line contains N integers Hi (1 <= Hi <= 8844).
It is guaranteed that any two adjacent height sampling values will be different.

Output

For each test case, output the number of peaks.

Sample Input

2
9
1 3 2 4 6 3 2 3 1
5
1 2 3 4 5

Sample Output

3
0

纯暴力。。送人头的

#include <iostream>
#include <cstring>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define LL long long
int a[55];
int main()
{
	int n,t;
	scanf("%d",&t);
	while(t--)
	{
	   scanf("%d",&n);
	   for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	   int cnt=0;
	   for(int i=1;i<n-1;i++)
		if(a[i]>a[i-1]&&a[i]>a[i+1])
			cnt++;
		printf("%d\n",cnt);
	}
	return 0;
}

J题:

Pretty Poem


Time Limit: 2 Seconds      Memory Limit: 65536 KB



Poetry is a form of literature that uses aesthetic and rhythmic qualities of language. There are many famous poets in the contemporary era. It is said that a few ACM-ICPC contestants
can even write poetic code. Some poems has a strict rhyme scheme like "ABABA" or "ABABCAB". For example, "niconiconi" is composed of a rhyme scheme "ABABA" with A = "ni" and B = "co".

More technically, we call a poem pretty if it can be decomposed into one of the following rhyme scheme: "ABABA" or "ABABCAB". The symbol AB and C are
different continuous non-empty substrings of the poem. By the way, punctuation characters should be ignored when considering the rhyme scheme.

You are given a line of poem, please determine whether it is pretty or not.

Input

There are multiple test cases. The first line of input contains an integer T indicating the number of test cases. For each test case:

There is a line of poem S (1 <= length(S) <= 50). S will only contains alphabet characters or punctuation characters.

Output

For each test case, output "Yes" if the poem is pretty, or "No" if not.

Sample Input

3
niconiconi~
pettan,pettan,tsurupettan
wafuwafu

Sample Output

Yes
Yes
No

暴力枚举。。

#include <iostream>
#include <cstring>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <queue>
using namespace std;
#define LL long long
char str[100];
bool is_ab()
{
	int len=strlen(str);
	for(int i=1;i<len;i++)//枚举a的长度
	{
		int lb=len-3*i;
		if(lb<1)break;
		if(lb%2)continue;
		lb/=2;
		if(lb==i&&!strncmp(str,str+i,i))//考虑a,b相同的情况
			continue;
		char t[555]="\0";
		strncat(t,str,i);//a
		strncat(t,str+i,lb);//b
		strncat(t,str,i);//a
		strncat(t,str+i,lb);//b
		strncat(t,str,i);//a
		if(!strcmp(str,t))
			return 1;
	}
	return 0;
}
bool is_abc()
{
   int len=strlen(str);
   for(int i=1;i<len;i++)//枚举a,b的长度
		for(int j=1;j<len;j++)
        {
   	       int lc=len-3*i-3*j;
   	       if(lc<1)
			continue;
		   if(i==j&&!strncmp(str,str+i,i))continue;//考虑a,b相同
		   if(i==lc&&!strncmp(str,str+2*i+2*j,i))continue;//考虑a,c相同
		   if(j==lc&&!strncmp(str+i,str+2*i+2*j,j))continue;//考虑b,c相同
		   char t[555]="\0";
		   strncat(t,str,i);
		   strncat(t,str+i,j);
		   strncat(t,str,i);
		   strncat(t,str+i,j);
		   strncat(t,str+2*i+2*j,lc);
		   strncat(t,str,i);
		   strncat(t,str+i,j);
		   if(!strcmp(str,t))
			return 1;
        }
        return 0;
}
int main()
{
	int t,p;char c;
	cin>>t;getchar();
	while(t--)
	{
		p=0;
		while((c=getchar())!='\n')
			if(isalpha(c))
				str[p++]=c;
		str[p]='\0';
		if(is_ab()||is_abc())
			puts("Yes");
		else
			puts("No");
	}
	return 0;
}
时间: 2024-10-12 00:03:29

acm_icpc网络赛第一站:牡丹江赛区的相关文章

acm_icpc网络赛第二站:鞍山赛区

这次..啥也不说了 chp他两上课来晚了..我也没账号..开场半小时才开始做的,就敲了一道水题..然后他们两一直在商量那道计算几何..最后还是没出来. Osu! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 140    Accepted Submission(s): 93 Special Judge Problem Descript

acm_icpc网络赛第六站:上海赛区(跪烂心已死)

最后一站了,很无奈的是还是没出线,最终3题结束,排名380 不得不承认自己不行,总觉着自己才弄了几个月,然后各种为自己的弱找借口,不行就是不行,没有借口,以后要更加努力了.废话不多说了 Fighting! 1006: Sawtooth Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 466    Accepted Submission(

acm_icpc网络赛第五站:北京赛区

北京嘛,没什么好说的..实验室貌似没出线的..哎 就一道水题还被我英语给坑了.. 哈希一水: Grade Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 344    Accepted Submission(s): 195 Problem Description Ted is a employee of Always Cook Mu

acm_icpc网络赛第三站:西安赛区

chp居然没来..然后我跟zmc鼓捣了一下午..出了3题 有一道貌似是DP水题..然后我俩都不会dp..A题水题不说了,E题博弈论模板..然后我俩也都不会博弈论..现场找的模板..F题无脑BFS..一开始看成计算几何了没敢做sad.. A题: Post Robot Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 57    Accept

网络工程师第一站

问题:办公楼连不上网 拓扑连接情况:办公楼交换机之间串联连接,并通过交换机1与核心交换机相连. 表现情况:办公楼交换机1与核心交换机之前的光纤跳线灯不亮:办公楼交换机1与其他办公楼焦化交换机的光纤跳线也不亮. 分析:光纤跳线灯不亮,说明物理链路有问题.而且之前办公楼是联网的,所以交换机配置之类的应该没有问题,应该是线虚. 解决方法:把光纤跳线拔下来,插在别的接口上.多试几次,若效果不佳,比如过一会跳线灯又不亮了,最好把这条光纤线(物理链路)换下来,重新步一条.

2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛

Banana Bananas are the favoured food of monkeys. In the forest, there is a Banana Company that provides bananas from different places. The company has two lists. The first list records the types of bananas preferred by different monkeys, and the seco

hdu 4405 概率dp 2012年金华亚洲网络赛--虽然水,但是是自己独立做的第一道概率dp

题目:http://acm.hdu.edu.cn/showproblem.php?pid=4405 e[i]:当前在位置i还需要走的步数期望 受刘汝佳的AC自动机那个后缀链接写法的启发,我的x[i]通过逆序算出来连续有"flight line "的时候,能到达的最远距离, rep(i,0,m) { scanf("%d%d",&xx,&yy); x[xx]=yy; } for(int i=n;i>=0;i--) if(x[i]!=-1 &

ICPC 2018 徐州赛区网络赛

ACM-ICPC 2018 徐州赛区网络赛 ?去年博客记录过这场比赛经历:该死的水题 ?一年过去了,不被水题卡了,但难题也没多做几道.水平微微有点长进. ? ? D. Easy Math 题意: ? 给定 \(n\), \(m\) ,求 \(\sum _{i=1}^{m} \mu(in)\) .其中 $ 1 \le n \le 1e12$ , $ 1 \le m \le 2e9$ ,\(\mu(n)\) 为莫比乌斯函数. ? 思路: ? 容易知道,\(i\) 与 \(n\) 不互质时, \(\m

2014 ACM/ICPC 牡丹江赛区现场赛

最近突然感觉状态不佳,可能是天冷的缘故? 赛后来做牡丹江赛区的题目 [A]3819 Average Score -- 签到题 [B] [C] [D] [E] [F] [G] [H] [I] [J] [K]3829 Known Notation -- 贪心 + 模拟 [A]3819 Average Score -- 签到题 Average Score Time Limit: 2 Seconds                                     Memory Limit: 65