http://acm.hdu.edu.cn/contests/contest_show.php?cid=802
三人三台电脑比赛,然而有个队友鸽了,只有两人打,一共过了5题
1001:水题,只需判断3和4的倍数即可,solved by lyy
#include
using namespace std;
#define ll long long
int t,n;
int main()
{
scanf("%d",&t);
while (t--)
{
scanf("%d",&n);
if (n%3==0) printf("%lld\n",(ll)(n/3)*(n/3)*(n/3));
else if (n%4==0) printf("%lld\n",2LL*(n/4)*(n/4)*(n/4));
else printf("-1\n");
}
return 0;
}
1003:水题,排序之后顺序取点即可, solved by lyy
#include
using namespace std;
#define ll long long
int t,n;
struct point
{
int id;
int x,y;
}p[3005];
bool cmp(point a,point b)
{
return a.x
1011:字符串处理,solved by sdn
/*
ID: oodt
PROG:
LANG:C++
*/
#include
#include
#include
#include
#include
#include
#include
1004:排序之后,直接暴力往数组里填数即可, solved by lyy
#include
using namespace std;
#define ll long long
int t,n,m;
int a[100005];
int sum[100005];
struct st
{
int l,r;
}p[100005];
bool cmp(st a,st b)
{
if (a.l!=b.l) return a.lr)
{
for (int j=l;j<=r;j++)
{
sum[a[j]]=0;
l++;
}
for (int j=l;jr)
{
for (int j=r;j
0) mi++;
}
}
}
}
int ma=p[1].r;
for (int i=1;i<=m;i++)
{
ma=max(ma,p[i].r);
}
for (int i=ma+1;i<=n;i++)
{
a[i]=1;
}
for (int i=1;i<=n;i++)
{
printf("%d",a[i]);
if (i!=n) printf(" ");
}
printf("\n");
}
return 0;
}
1007:打表,然后扔到OEIS里,找到一段python代码,研究一下发现可以二分写, solved by lyy
#include
using namespace std;
#define ll long long
const ll mod=1000000007;
int t;
ll n;
long long inv(long long a,long long m)
{
if(a == 1)return 1;
return inv(m%a,m)*(m-m/a)%m;
}
ll inv2=inv(2,mod);
ll f(ll x)
{
if (x==1) return 1;
else return x+f(x/2);
}
ll find(ll n)
{
ll l=1,r=n;
ll m;
while (l<=r)
{
m=(l+r)/2;
if (f(m)