-TEST Fin 1 for NOIP 垃圾电脑(300-300)

头更更更大

这个11月完就要去搞NOIP了。。。

11月10天也就3次测试。。。为保佑进省一我还是每次测试玩都写个总结。。


emmm。。。
因为是最后一次测试所以为了给我们增长信心zgs给了我们一套伪Day1题。
题目怕是普及组难度都不到。。然而叫我们一个小时内打出来。
结果当然是300的一群一群的然后200多的还很不好意思。。

这是考的题大家看着乐就行:
这里写图片描述

是不是很和善的样子(A_A)

T1:

这里写图片描述

T2:

这里写图片描述

T3:

这里写图片描述
这里写图片描述

最气人的是。。
我第一道题打的哈希表。。
然而评测数据水得吓人。。。
有一个人直接只开了200000的数组都过了。。。






然而
我就取了200004的模,再开了个300000的数组竟然RE了五个点。
在其他评测机上一点事情都没有。。。






这里写图片描述






更气人的是在soj上评测完全没事。。。
然后我就从300硬生生卡到250。





这里写图片描述

感想:

垃圾电脑,毁我青春!!

垃圾电脑,毁我青春!!

垃圾电脑,毁我青春!!

这里写图片描述

















蛤?还要代码?这题不很简单一个小时就能搞定吗

代码:(第一题的代码极水,请慎重食用)

T1:

#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
using namespace std;

inline int read()
{
    int X=0,w=1; char ch=0;
    while(ch<'0' || ch>'9') {if(ch=='-') w=-1;ch=getchar();}
    while(ch>='0' && ch<='9') X=(X<<3)+(X<<1)+ch-'0',ch=getchar();
    return X*w;
}

#define U_MAX 200
inline char *get_str(char *str)
{
    fgets(str,U_MAX,stdin);
    if(str[strlen(str)-1] == '\n')
        str[strlen(str)-1] = '\0';
    return str;
}

inline void write(int x)
{
     if(x<0) putchar('-'),x=-x;
     if(x>9) write(x/10);
     putchar(x%10+'0');
}

int hash[300005];
int num[300005];
int loc(int x)
{
    int tmp=x%200004;
    while(hash[tmp]&&hash[tmp]!=x)tmp=(tmp+1)%200004;
    return tmp;
}

int insert(int x)
{
    int tmp=x%200004;
    while(hash[tmp]&&hash[tmp]!=x)tmp=(tmp+1)%200004;
    hash[tmp]=x;    num[tmp]++;
    return tmp;
}

int n,c,ans=0;
int a[300005],spe;
int main()
{
    freopen("pair.in","r",stdin);
    freopen("pair.out","w",stdout); 
    n=read();c=read();
    for(int i=1;i<=n;i++)
    {
        a[i]=read();
        int x=insert(a[i]);     
        if(num[x]>1)i-=1,n-=1;      
    }
    for(int i=1;i<=n;i++)
    {
        int h1=loc(a[i]-c),h2=loc(a[i]),h3=loc(a[i]+c);
        if(hash[h1]==a[i]-c)ans+=num[h1]*num[h2];
        if(hash[h3]==a[i]+c)ans+=num[h3]*num[h2];
    }
    cout<<ans/2<<endl;
}

T2:

#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
using namespace std;

inline int read()
{
    int X=0,w=1; char ch=0;
    while(ch<'0' || ch>'9') {if(ch=='-') w=-1;ch=getchar();}
    while(ch>='0' && ch<='9') X=(X<<3)+(X<<1)+ch-'0',ch=getchar();
    return X*w;
}

#define U_MAX 200
inline char *get_str(char *str)
{
    fgets(str,U_MAX,stdin);
    if(str[strlen(str)-1] == '\n')
        str[strlen(str)-1] = '\0';
    return str;
}

inline void write(int x)
{
     if(x<0) putchar('-'),x=-x;
     if(x>9) write(x/10);
     putchar(x%10+'0');
}
const int mod=10007;
int n;
int as,ans=1;
char s[150];
int main()
{
    freopen("word.in","r",stdin);
    freopen("word.out","w",stdout); 
    get_str(s);n=strlen(s);
    for(int i=1;i<=n;i++)
    {
        as=s[i-1]-'a'+1;
        ans=(as*ans)%mod;
    }
    cout<<ans<<endl;
}

T3:

#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
using namespace std;

inline int read()
{
    int X=0,w=1; char ch=0;
    while(ch<'0' || ch>'9') {if(ch=='-') w=-1;ch=getchar();}
    while(ch>='0' && ch<='9') X=(X<<3)+(X<<1)+ch-'0',ch=getchar();
    return X*w;
}

#define U_MAX 200
inline char *get_str(char *str)
{
    fgets(str,U_MAX,stdin);
    if(str[strlen(str)-1] == '\n')
        str[strlen(str)-1] = '\0';
    return str;
}

inline void write(int x)
{
     if(x<0) putchar('-'),x=-x;
     if(x>9) write(x/10);
     putchar(x%10+'0');
}
const int kkk=50;
int first[kkk],cnt=0;
struct node{int u,v,next;}side[2*kkk];
void add(int u,int v)
{
    side[++cnt].u=u;
    side[cnt].v=v;
    side[cnt].next=first[u];
    first[u]=cnt;
}
int n,k,a,b;
int son[10];
int ans=1;
int vis[10];
int dfs(int u)
{
    vis[u]=true;int anss=1;
    for(int i=first[u];i;i=side[i].next)
    {
        int v=side[i].v;
        if(!vis[v])
        anss+=dfs(v);
    }
    return anss;
}
int h[50];
char s[50];
int main()
{
    //freopen("produce.in","r",stdin);
    //freopen("produce.out","w",stdout);    
    cin>>(s+1)>>k;
    n = strlen(s+1);
    for(int i = 1; i <= n; ++i)
        h[i] = s[i] - '0';
    for(int i=1;i<=k;i++)
    {
        a=read();b=read();
        add(a,b);
    }
    n+=1;
    while(n--)
    {
        memset(vis,0,sizeof(vis));
        int hh=dfs(h[n]);
        ans*=hh;
    }
    cout<<ans<<endl;
}

我就打那么长的优化你来打我啊

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值