## 1.今天考了套题。

### Mumu[nim+高精]

#include<cstdio>

int st[160],len,lenm,m[160],n[160],lenn,ans,now,sum;

inline void m_in(){
char ch=getchar();
while (ch<'0'||ch>'9') ch=getchar();
while (ch>='0'&&ch<='9'){
st[++len]=ch-'0';
ch=getchar();
}
for (int i=len;i>=1;i--) m[++lenm]=st[len--];
}

inline void n_in(){
char ch=getchar();
while (ch<'0'||ch>'9') ch=getchar();
while (ch>='0'&&ch<='9'){
st[++len]=ch-'0';
ch=getchar();
}
for (int i=len;i>=1;i--) n[++lenn]=st[len--];
}

inline bool judge(){//比较此时m是否小于等于n
if (lenm<lenn) return true;
if (lenm>lenn) return false;
if (lenm==lenn){
for (int i=lenm;i>=1;i--)
if (m[i]>n[i]) return false;
else if (m[i]<n[i]) return true;
}
return true;
}

/*inline void m_write(){
for (int i=lenm;i>=1;i--) printf("%d",m[i]);
putchar('\n');
}*/

for (int i=1;i<=lenm;i++){
m[i]=(m[i]<<1)+now;
if (m[i]>=10) m[i]-=10,now=1;
else now=0;
}
if (now){
lenm++;
m[lenm]=1;
now=0;
}
}

int main(){
freopen("Mumu.in","r",stdin);
freopen("Mumu.out","w",stdout);
m_in();
n_in();
while (judge()){
//m_write();
sum++;
}
//m_write();
ans=(sum-1)%6;
if (ans==0) puts("0");
else if (ans==1) puts("2");
else if (ans==2) puts("4");
else if (ans==3) puts("8");
else if (ans==4) puts("16");
else if (ans==5) puts("32");
return 0;
}

### Susu[计算几何+DP]

Score = SUM{value[i] | i 属于 S} \* SUM{mul[i] | i 属于 S} / |S|

dp[i]=fmax(dp[i],dp[j]+(point[j+1~i])*(bei[j+1~i])/(num[j+1~i]));

#include<cstdio>
#include<cmath>
#include<algorithm>
#define fmax(a,b) ((a)>(b)?(a):(b))

using namespace std;

const double EPS=1e-8;
struct node{
long long x,y;
long long point,bei;
double zero;
}e[2010];
long long n,m,a,sump[2010],sumb[2010],sums[2010],ay[2010],ap[2010],ab[2010],as[2010];
double dp[2010],az[2010];

inline long long v_in(){
char ch=getchar();
long long sum=0,f=1;
while (ch<'0'||ch>'9'){
if (ch=='-') f=-1;
ch=getchar();
}
while (ch>='0'&&ch<='9'){
sum=(sum<<3)+(sum<<1)+(ch^48);
ch=getchar();
}
return sum*f;
}

bool cmp1(const node &a,const node &b){
return a.y<b.y;
}

bool cmp2(const node &a,const node &b){
return a.x<b.x;
}

bool cmp3(const node &a,const node &b){
return a.zero<b.zero;
}

int main(){
freopen("Susu.in","r",stdin);
freopen("Susu.out","w",stdout);
n=v_in();
for (register long long i=1;i<=n;i++){
e[i].x=v_in();
e[i].y=v_in();
e[i].point=v_in();
e[i].bei=v_in();
}
a=v_in();
if (a==0||a==180){
sort(e+1,e+n+1,cmp1);//按照y排序
ay[1]=e[1].y;
ap[1]=e[1].point;
ab[1]=e[1].bei;
as[1]=1;
m=1;
for (register long long i=2;i<=n;i++)
if (e[i].y==ay[m]){
ap[m]+=e[i].point;
ab[m]+=e[i].bei;
as[m]++;
}
else{
ay[++m]=e[i].y;
ap[m]=e[i].point;
ab[m]=e[i].bei;
as[m]=1;
}
}
else if (a==90){
sort(e+1,e+n+1,cmp2);//按照x排序
ay[1]=e[1].x;
ap[1]=e[1].point;
ab[1]=e[1].bei;
as[1]=1;
m=1;
for (register long long i=2;i<=n;i++)
if (e[i].x==ay[m]){
ap[m]+=e[i].point;
ab[m]+=e[i].bei;
as[m]++;
}
else{
ay[++m]=e[i].x;
ap[m]=e[i].point;
ab[m]=e[i].bei;
as[m]=1;
}
}
else{//按照倾斜直线在y轴上的位置排序
double tana=tan(((double)a/180)*3.1415926);
//printf("%lf\n",tana);
for (register long long i=1;i<=n;i++){
e[i].zero=(double)e[i].y-((double)e[i].x*tana);
//printf("%lf %lf %lf\n",e[i].zero,(double)e[i].y,(double)e[i].x*tana);
}
sort(e+1,e+n+1,cmp3);
az[1]=e[1].zero;
ap[1]=e[1].point;
ab[1]=e[1].bei;
as[1]=1;
m=1;
for (register long long i=2;i<=n;i++)
if (e[i].zero-az[m]<EPS&&e[i].zero-az[m]>-EPS){
ap[m]+=e[i].point;
ab[m]+=e[i].bei;
as[m]++;
}
else{
az[++m]=e[i].zero;
ap[m]=e[i].point;
ab[m]=e[i].bei;
as[m]=1;
}
}
for (register long long i=1;i<=m;i++){
sump[i]=sump[i-1]+ap[i];
sumb[i]=sumb[i-1]+ab[i];
sums[i]=sums[i-1]+as[i];
//printf("%lld %lld %lld\n",ap[i],ab[i],as[i]);
}
for (register long long i=1;i<=m;i++)
for (register long long j=0;j<i;j++)
dp[i]=fmax(dp[i],dp[j]+(double)((sump[i]-sump[j])*(sumb[i]-sumb[j]))/(sums[i]-sums[j]));
//for (int i=1;i<=m;i++) printf("%.3lf\n",dp[i]);
printf("%.3lf\n",dp[m]);
return 0;
}

### Ssjmm[SPFA+DP]

fmax(0,dis[from][to]+(f[from]-f[to])*(fmax(w[from]-w[to],w[to]-w[from])));

#include<cstdio>
#define MAXN 2147000000
#define fmax(a,b) ((a)>(b)?(a):(b))
#define fmin(a,b) ((a)<(b)?(a):(b))

struct edge{
long long to,val,next;
}e[30010];
long long n,m,len;

inline long long v_in(){
char ch=getchar();
long long sum=0;
while (ch<'0'||ch>'9') ch=getchar();
while (ch>='0'&&ch<='9'){
sum=(sum<<3)+(sum<<1)+(ch^48);
ch=getchar();
}
return sum;
}

inline void addedge(long long u,long long v,long long w){
e[++len].to=v;
e[len].val=w;
}

int main(){
freopen("Ssjmm.in","r",stdin);
freopen("Ssjmm.out","w",stdout);
n=v_in();
m=v_in();
for (register long long i=1;i<=n;i++) f[i]=v_in();
for (register long long i=1;i<=n;i++) w[i]=v_in();
for (register long long i=1;i<=n;i++) s[i]=v_in();
for (register long long i=1;i<=m;i++){
long long u=v_in(),v=v_in(),w=v_in();
}
dis[0][1]=0;
dis[1][1]=s[1];
for (register long long i=2;i<=n;i++) dis[0][i]=dis[1][i]=MAXN;
long long hd=0,tl=1;
vis[1]=true;
q[1]=1;
while (hd!=tl){
if (++hd>n) hd=1;
long long u=q[hd];
if (f[u]){
dis[0][u]=fmin(dis[0][u],dis[1][u]);
dis[1][u]=fmin(dis[1][u],dis[0][u]+s[u]);
}
else{
dis[0][u]=fmin(dis[0][u],dis[1][u]+s[u]);
dis[1][u]=fmin(dis[1][u],dis[0][u]);
}
for (register long long i=head[u];i!=0;i=e[i].next){
long long v=e[i].to;
long long dist1=fmax(0,e[i].val+(f[u]-f[v])*(fmax(w[u]-w[v],w[v]-w[u])));//这是没有反过来的边权
long long dist2=fmax(0,e[i].val-(f[u]-f[v])*(fmax(w[u]-w[v],w[v]-w[u])));//这是颠倒后的边权
if (dis[1][v]>dis[0][u]+dist1){
dis[1][v]=dis[0][u]+dist1;
if (!vis[v]){
vis[v]=true;
if (++tl>n) tl=1;
q[tl]=v;
}
}
if (dis[0][v]>dis[1][u]+dist2){
dis[0][v]=dis[1][u]+dist2;
if (!vis[v]){
vis[v]=true;
if (++tl>n) tl=1;
q[tl]=v;
}
}
}
vis[u]=false;
}
printf("%I64d\n",fmin(dis[0][n],dis[1][n]));
return 0;
}

A*

cdq分治

### 4.今天晚上任务

<<数学一本通>>要开始看了。争取两天内看完第一章数论吧。