题目链接
01:http://acm.hdu.edu.cn/showproblem.php?pid=6133
02:http://acm.hdu.edu.cn/showproblem.php?pid=6134
03:http://acm.hdu.edu.cn/showproblem.php?pid=6135
04:http://acm.hdu.edu.cn/showproblem.php?pid=6136
05:http://acm.hdu.edu.cn/showproblem.php?pid=6137
06:http://acm.hdu.edu.cn/showproblem.php?pid=6138
07:http://acm.hdu.edu.cn/showproblem.php?pid=6139
08:http://acm.hdu.edu.cn/showproblem.php?pid=6140
09:http://acm.hdu.edu.cn/showproblem.php?pid=6141
10:http://acm.hdu.edu.cn/showproblem.php?pid=6142
11:http://acm.hdu.edu.cn/showproblem.php?pid=6143
这把比赛做出两题,全靠队友最后半小时a掉2题。
一些题解
08 Hybrid Crystals
#include <bits/stdc++.h>
const int maxn = 1010;
using namespace std;
inline int read()
{
int x=0,f=1;char ch = getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
struct node{
int num;
char sta[5];
bool operator < ( node &b)
{
return num < b.num;
}
}a[maxn];
int main()
{
int T = read();
while(T--)
{
int n = read(),k = read();
for(int i = 0; i < n; i++) a[i].num = read();
for(int i = 0; i < n; i++) scanf("%s", a[i].sta);
int cnt = 0;
int p = n-1;
while(p >= 0)
{
if(cnt < k)
{
while(strcmp(a[p--].sta, "D") == 0 && p >= 0);
cnt += a[p+1].num;
}
else
{
while(strcmp(a[p--].sta, "L") == 0 && p >= 0);
cnt -= a[p+1].num;
}
if(cnt==k) break;
}
if(cnt == k) printf("yes\n");
else printf("no\n");
}
return 0;
}
11 Killer Names
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll maxn = 2500;
const ll mod = 1e9+7;
ll c[maxn][maxn];
ll f[maxn];
ll mi[maxn];
ll quick_mod(ll a, ll b)
{
ll ans = 1;
a %= mod;
while(b)
{
if(b & 1)
{
ans = ans * a % mod;
b--;
}
b >>= 1;
a = a * a % mod;
}
return ans;
}
void init()
{
f[1] = 1;
f[2] = 2;
for(ll i = 3; i < maxn; i++)
f[i] = f[i-1] * i % mod;
c[1][0] = c[1][1] = 1;
for(ll i = 2; i < maxn; i++)
{
c[i][0] = 1;
for(ll j = 1; j < maxn; j++)
{
c[i][j] = (c[i-1][j] + c[i-1][j-1])%mod;
}
}
}
ll solve(ll n, ll i)
{
ll he = mi[i]%mod;
ll sign = 1;
for(ll ii = i-1; ii > 0; ii--)
{
if(sign == 1)
{
he -= (c[i][ii]%mod)*(mi[ii]%mod);
he = he%mod;
while(he < 0 )
he += mod;
sign = 0;
}
else
{
he += (c[i][ii]%mod)*(mi[ii]%mod);
he = he%mod;
sign = 1;
}
}
return he;
}
int main()
{
ll T;
scanf("%lld", &T);
init();
while(T--)
{
ll n, m;
scanf("%lld%lld", &n, &m);
ll ans = 0;
for(ll i = 1; i <= m; i++)
mi[i] = quick_mod(i, n);
for(ll i = 1; i < m && i <= n; i++)
{
ll NAME1 = solve(n, i);
ll NAME2 = mi[m-i];
ll TOT = (NAME1%mod)*(NAME2%mod)%mod;
ans += TOT * c[m][i];
ans %= mod;
}
printf("%lld\n", ans);
}
return 0;
}