说来惭愧,感觉自己虽然高中语文很好,但是到大学一直很懒不是很喜欢写东西,很佩服smchao和wdfei能一直坚持的写一是不知道自己去些什么,但是最近老师很想让我们多去写一些东西,好吧,这实际上就是在骗字数,不好意思被你发现了。
言归正传,cf那天写一下,对于一个不搞acm的人来说,我只能对自己的too young,too simple感到深深鄙视。
第一道题,题读明白了就很好写,简单的模拟。
第二道题,又是模拟,只不过把需要优化一层循环。
第三题,当时没读懂题,后来cyin告诉我就是模拟代码很简单,很清晰,我无耻的把cyin代码贴出。
第四题,我挑了代码最适合我这种智商上限的人看了看,感慨大师的代码水准,感觉思想就是求出每个字符的最大跳转距离。贴出大师的代码。
对于一个行将就木的大三狗,越发佩服cyin大神在区域赛披金斩金,希望今年wf友好的表现。
/*
2013_6_7_div_2_a
*/
#include<stdio.h>
int bottle_a[101], bottle_b[101],bottle_c[101];
int main(void)
{
int i, n, j,num=0;
scanf("%d",&n);
for (i=0; i<n; i++)
{
scanf("%d %d",&bottle_a[i],&bottle_b[i]);
bottle_c[i]=1;
}
for (i=0; i<n; i++)
for (j=0; j<n;j++)
{
if(i!=j&&bottle_b[i]==bottle_a[j])
bottle_c[j]=0;
}
for (i=0; i<n; i++)
num+=bottle_c[i];
printf("%d\n",num);
//while(1);
return 0;
}
/*
2013_6_7_b
*/
#include<stdio.h>
int mm[100001];
int add=0;
int main(void)
{
int n,m,i,j,t,vi,xi,yi,qi,k;
scanf("%d%d",&n,&m);
for (i=0; i<n; i++)
scanf("%d",&mm[i]);
//printf("*******\n");
for (i=0; i<m; i++)
{
scanf("%d",&t);
// printf("%d______\n",mm[9]);
if (t==1)
{
scanf("%d%d",&vi,&xi);
mm[vi-1]=xi-add;
}
else if (t==2)
{
scanf("%d",&yi);
add+=yi;
}
else if (t==3)
{
scanf("%d",&qi);
//for(j=0;j<k;j++)
//mm[qi-1]add;
printf("%d\n",mm[qi-1]+add);
}
}
//while(1);
return 0;
}
/*
2013_6_7_c
*/
#include<stdio.h>
#include<string.h>
long long a[200010];
int n,m;
int main(){
//freopen("a.in","r",stdin);
long long d,sum=0;
int i,tn,tt;
scanf("%d%d",&n,&m);
for (i=1;i<=n;i++) scanf("%I64d",&a[i]);
tn=n;
tt=0;
for (i=1;i<=n;i++){
tt++;
d=sum-(tt-1)*(tn-tt)*a[i];
//printf("%I64d\n",d);
if (d<m){
tt--;
tn--;
printf("%d\n",i);
continue;
}
sum=sum+a[i]*(tt-1);
}
//while (1);
return 0;
}
/*
2013_6_7_d
*/
#include <stdio.h>
#include <string.h>
#define MAX 103
typedef long long ll;
char str1[MAX],str2[MAX];
ll tot[MAX],last[MAX];
int main()
{
ll b,d,len1,len2,i,now,j,ans;
scanf("%I64d%I64d",&b,&d);
scanf("%s%s",str1,str2);
len1=strlen(str1);
len2=strlen(str2);
for (i=0;i<len2;i++)
{
tot[i]=0;
now=i;
for (j=0;j<len1;j++)
{
if (str1[j]==str2[now])
{
now++;
if (now==len2)
{
tot[i]++;
now=0;
}
}
}
last[i]=now;
}
now=0;
ans=0;
for (i=0;i<b;i++)
{
if (tot[now]==0&&last[now]==now) break;
ans+=tot[now];
now=last[now];
}
printf("%I64d\n",ans/d);
return 0;
}