http://acm.hdu.edu.cn/contests/contest_show.php?cid=804
这次比赛有一个队友又鸽了,我们只过了4题,没有进前200名
1004:水题,只有2,3,4,6不可以 solved by lyy
#include
using namespace std;
#define ll long long
int t,k;
int main()
{
scanf("%d",&t);
while (t--)
{
scanf("%d",&k);
if (k==1) printf("5\n");
else if (k==2) printf("7\n");
else printf("%d\n",5+k);
}
return 0;
}
1006:异或和位0是平局,其余都是Q神获胜 solved by lyy
#include
using namespace std;
#define ll long long
int t;
int n;
int main()
{
scanf("%d",&t);
while (t--)
{
scanf("%d",&n);
int ans=0;
for (int i=1;i<=n;i++)
{
int x;
scanf("%d",&x);
ans^=x;
}
for (int i=1;i
1012:简单模拟题 solved by sdn
/*
ID: oodt
PROG:
LANG:C++
*/
#include
#include
#include
#include
#include
#include
#include
#include
1001:从左往右递推更新
#include
using namespace std;
#define ll long long
int t;
int n,m,k,p,q,r;
int mod;
int a[10000005];
int b[10000005];
int main()
{
//freopen("in.txt","r",stdin);
scanf("%d",&t);
while (t--)
{
scanf("%d%d%d%d%d%d%d",&n,&m,&k,&p,&q,&r,&mod);
for (int i=1;i<=k;i++)
{
scanf("%d",&a[i]);
}
for (int i=k+1;i<=n;i++)
{
a[i]=(int)(((ll)p*a[i-1]+(ll)q*i+r)%mod);
}
//memset(b,0,sizeof(b));
b[n]=n;
for (int i=n-1;i>=1;i--)
{
int x=i+1;
while (!(a[x]>a[i] || b[x]==x))
{
x=b[x];
}
if (a[x]>a[i]) b[i]=x;
else b[i]=i;
}
ll ans_count=0,ans_rate=0;
int rate=0;
int count=0;
for (int i=1;i<=m;i++)
{
if (a[i]>rate)
{
rate=a[i];
count++;
}
}
//cout<<"1 "<rate);
rate=max(rate,a[i+m-1]);
}
else if (a[i]>a[i-1])
{
if (a[i-1]==0) count++;
count=count-1+(a[i+m-1]>rate);
rate=max(rate,a[i+m-1]);
}
else
{
if (b[i-1]==i-1 || b[i-1]>i+m-1)
{
count=0;
rate=0;
if (a[i]!=0)
{
count++;
rate=a[i];
}
int x=i;
while (b[x]!=x && b[x]<=i+m-1)
{
x=b[x];
count++;
rate=a[x];
}
}
else
{
if (a[i+m-1]>rate) count++;
rate=max(rate,a[i+m-1]);
if (a[i]==0) count--;
int x=i;
while (b[x]!=b[i-1])
{
x=b[x];
count++;
}
count=count+(a[i+m-1]>rate);
}
}
ans_count+=count^i;
ans_rate+=rate^i;
//cout<