B

判矩阵的时候 出了点错 根据点积判垂直 叉积判平行 面积不能为0

 #include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
#include<vector>
#include<cmath>
using namespace std;
struct node
{
int x,y;
}p[];
int f[];
int find(node a,node b,node c,node d)
{
int flag = ;
if(a.x-b.x==||c.y-b.y==||c.x-d.x==||d.y-a.y==)
return ;
if((a.x-b.x)*(b.x-c.x)+(a.y-b.y)*(b.y-c.y)==&&(a.x-b.x)*(d.y-c.y)==(a.y-b.y)*(d.x-c.x)&&(a.x-d.x)*(b.y-c.y)==(a.y-d.y)*(b.x-c.x))
flag = ;
if(flag&&abs(a.x-b.x)==abs(c.y-b.y))
flag = ;
return flag;
}
int judge(node a,node b,node c,node d)
{
struct node q[];
q[] = a;q[] = b;
q[] = c;q[] = d;
int i,j,g,o;
int flag = ;
for(i = ; i <= ; i++)
for(j = ; j <= ; j++)
{
if(j==i) continue;
for(g = ; g <= ; g++)
{
if(g==i||g==j) continue;
for(o = ; o <= ; o++)
{
if(o==i||o==g||o==j) continue;
int gg = find(q[i],q[j],q[g],q[o]);
if(gg==)
{
flag = ;
return flag;
}
else if(gg==)
{
flag = ;
}
}
}
}
return flag;
}
int main()
{
int i,j,k,o,g;
while(cin>>p[].x>>p[].y)
{
memset(f,,sizeof(f));
int flag = ;
for(i = ; i <= ; i++)
cin>>p[i].x>>p[i].y;
for(i = ;i <= ; i++)
{
for(j = ;j <= ; j++)
{
if(j==i) continue;
for(k =; k <= ; k++)
{
if(k==i||k==j) continue;
for(o = ; o <= ; o++)
{
if(o==k||o==j||o==i) continue;
if(judge(p[i],p[j],p[k],p[o])!=) continue;
int kk=;
for(g = ; g <= ; g++)
{
if(g!=i&&g!=j&&g!=k&&g!=o)
f[++kk] = g;
}
if(judge(p[f[]],p[f[]],p[f[]],p[f[]]))
{
flag = ;
break;
}
}
if(flag) break;
}
if(flag) break;
}
if(flag) break;
}
if(flag)
{
puts("YES");
int kk=;
cout<<i<<" "<<j<<" "<<k<<" "<<o<<endl;
cout<<f[]<<" "<<f[]<<" "<<f[]<<" "<<f[]<<endl;
}
else
puts("NO");
}
return ;
}

C

分各种情况讨论 注意左边为高位

 #include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
#include<vector>
#include<cmath>
using namespace std;
#define N 100010
char s[N],ss[N];
int main()
{
int i,k;
cin>>s;
k = strlen(s);
int num = ,a=,b=,o1=-,o2=-,o3=-;
for(i = ; i < k; i++)
{
if(s[i]=='?'){num++;o1=i;}
if(s[i]==''){a++;o2=i;}
if(s[i]==''){b++;o3 = i;}
}
int kk = (k-)/;
if(num==)
{
if(b<=kk)
puts("");
else if(b-kk==)
{
if(s[k-]=='')
puts("");
else
puts("");
}
else
puts("");
}
else
{
if(b+num<=kk)
puts("");
else if(b+num-kk==)
{
if(o1>o2||o3>o2)
{
puts("");
puts("");
}
else
{
puts("");
puts("");
}
}
else
{
if(b-kk>=)
puts("");
else if(b-kk==)
{
if(o3>o2&&o3>o1)
{
puts("");
puts("");
}
else
{
puts("");
puts("");
}
}
else
{
if(o1>o2&&o1>o3)
{
puts("");
puts("");
puts("");
puts("");
}
else if(o2>o3&&o2>o1)
{
puts("");
puts("");
puts("");
}
else
{
puts("");
puts("");
puts("");
}
}
}
}
return ;
}
05-08 15:38