# A - Game

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <map>
#include <cmath>
#include <string>
#include <queue>
#include <stack>

using namespace std;

const int maxn = 1e3+10;

int a[maxn];

int main()
{
int n;
ios::sync_with_stdio(false);
cin >> n;
for(int i=0;i<n;i++)
{
cin >> a[i];
}
sort(a,a+n);
cout << a[(n+1)/2-1] << endl;
return 0;
}


# B - Minesweeper

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <map>
#include <cmath>
#include <string>
#include <queue>
#include <stack>

using namespace std;

const int maxn = 110;

char bomb[maxn][maxn];

int xx[8]={-1,0,1,-1,1,-1,0,1};
int yy[8]={-1,-1,-1,0,0,1,1,1};

int check(int x,int y)
{
int num = 0;
for(int i=0;i<8;i++)
{
int nx = x + xx[i];
int ny = y + yy[i];
if(bomb[nx][ny] == '*')
{
num++;
}
}
return num;
}

int main()
{
int n,m;
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)
{
getchar();
for(int j=1;j<=m;j++)
{
scanf("%c",&bomb[i][j]);
}
}
bool win = true;
for(int i=1;win&&i<=n;i++)
{
for(int j=1;win&&j<=m;j++)
{
int num = check(i,j);
if(bomb[i][j] == '.')
{
if(num>0)
{
win = false;
}
}
else if(bomb[i][j] == '*')
{
continue;
}
else
{
if(bomb[i][j] - '0' != num)
{
win = false;
}
}
}
}
if(win)
{
printf("YES\n");
}
else
{
printf("NO\n");
}
return 0;
}


# C - Finite or not?

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <map>
#include <cmath>
#include <string>
#include <queue>
#include <stack>

using namespace std;

const int maxn = 1e5+10;

typedef long long ll;

int main()
{
//cout << 24%6;
int n;
scanf("%d",&n);
while(n--)
{
ll p,q,b;
scanf("%I64d%I64d%I64d",&p,&q,&b);
ll temp = __gcd(p,q);
q /= temp;
//ll nq = 1LL;
temp = b;
while(temp > 1LL)
{
temp = __gcd(q,temp);
//nq = q;
q /= temp;
}
if(q == 1LL)
{
printf("Finite\n");
}
else
{
printf("Infinite\n");
}
}
return 0;
}


# D - XOR-pyramid

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <map>
#include <cmath>
#include <string>
#include <queue>
#include <stack>

using namespace std;

const int maxn = 5e3+10;

typedef long long ll;

ll a[maxn][maxn];
ll re[maxn][maxn];

int main()
{
//cout << (30 ^ 60) << endl;
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%I64d",&a[0][i]);
re[0][i] = a[0][i];
}
for(int i=1;i<n;i++)
{
for(int j=0;j<n-i;j++)
{
a[i][j] = (a[i-1][j] ^ a[i-1][j+1]);
re[i][j] = max(max(re[i-1][j],re[i-1][j+1]),a[i][j]);
//cout << re[i][j] << "*";
}
//cout << endl;
}
/*for(int i=1;i<n;i++)
{
for(int j=0;j<n-i;j++)
{
cout << a[i][j] << "*";
}
cout << endl;
}*/
int q;
scanf("%d",&q);
while(q--)
{
int l,r;
scanf("%d%d",&l,&r);
int len = r-l;
printf("%I64d\n",re[len][l-1]);
}
return 0;
}


• 广告
• 抄袭
• 版权
• 政治
• 色情
• 无意义
• 其他

120