这个11月完就要去搞NOIP了。。。
11月10天也就3次测试。。。为保佑进省一我还是每次测试玩都写个总结。。
emmm。。。
因为是最后一次测试所以为了给我们增长信心zgs给了我们一套伪Day1题。
题目怕是普及组难度都不到。。然而叫我们一个小时内打出来。
结果当然是300的一群一群的然后200多的还很不好意思。。
是不是很和善的样子(A_A)
最气人的是。。
我第一道题打的哈希表。。
然而评测数据水得吓人。。。
有一个人直接只开了200000的数组都过了。。。
然而
我就取了200004的模,再开了个300000的数组竟然RE了五个点。
在其他评测机上一点事情都没有。。。
更气人的是在soj上评测完全没事。。。
然后我就从300硬生生卡到250。
垃圾电脑,毁我青春!!
垃圾电脑,毁我青春!!
垃圾电脑,毁我青春!!
蛤?还要代码?这题不很简单一个小时就能搞定吗
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
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<2<
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
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<
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
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<
我就打那么长的优化你来打我啊