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 ;
}

Codeforces Beta Round #97 (Div. 1)的更多相关文章

  1. Codeforces Beta Round #97 (Div. 1) C. Zero-One 数学

    C. Zero-One 题目连接: http://codeforces.com/contest/135/problem/C Description Little Petya very much lik ...

  2. Codeforces Beta Round #97 (Div. 1) B. Rectangle and Square 暴力

    B. Rectangle and Square 题目连接: http://codeforces.com/contest/135/problem/B Description Little Petya v ...

  3. Codeforces Beta Round #97 (Div. 1) A. Replacement 水题

    A. Replacement 题目连接: http://codeforces.com/contest/135/problem/A Description Little Petya very much ...

  4. Codeforces Beta Round #97 (Div. 2)

    A题求给出映射的反射,水题 #include <cstdio> int x,ans[105],n; int main(){ scanf("%d",&n); fo ...

  5. Codeforces Beta Round #80 (Div. 2 Only)【ABCD】

    Codeforces Beta Round #80 (Div. 2 Only) A Blackjack1 题意 一共52张扑克,A代表1或者11,2-10表示自己的数字,其他都表示10 现在你已经有一 ...

  6. Codeforces Beta Round #83 (Div. 1 Only)题解【ABCD】

    Codeforces Beta Round #83 (Div. 1 Only) A. Dorm Water Supply 题意 给你一个n点m边的图,保证每个点的入度和出度最多为1 如果这个点入度为0 ...

  7. Codeforces Beta Round #79 (Div. 2 Only)

    Codeforces Beta Round #79 (Div. 2 Only) http://codeforces.com/contest/102 A #include<bits/stdc++. ...

  8. Codeforces Beta Round #77 (Div. 2 Only)

    Codeforces Beta Round #77 (Div. 2 Only) http://codeforces.com/contest/96 A #include<bits/stdc++.h ...

  9. Codeforces Beta Round #76 (Div. 2 Only)

    Codeforces Beta Round #76 (Div. 2 Only) http://codeforces.com/contest/94 A #include<bits/stdc++.h ...

随机推荐

  1. mysql查看连接数和状态,设置连接数和超时时间

    1.mysql> show status like '%connect%'; Connections,试图连接到(不管是否成功)MySQL服务器的连接数.   Max_used_connecti ...

  2. JsUnit && JUnit之讲解

    首先我们定义我们的函数 这里以最简单的加减乘除四个方法来进行测试 建立我们的js文件myjs.js function add(num1,num2){ return num1 + num2; } fun ...

  3. switch语句的使用,非常好

    这是谭浩强课本上枚举类型的例子,但是我贴这个例子的代码不是因为枚举类型,是因为这个代码使用switch语句用得非常好,值得一贴. 题目是这样的:有红.黄.蓝.白.黑5中颜色的球若干,依次取出3个球,求 ...

  4. Runtime的用法

    public class RuntimeTest { public static void main(String[] args) { Runtime run =Runtime.getRuntime( ...

  5. 运行时修改TimerTask的执行周期

    java.util.TimerTask类的执行周期period变量的声明如下: /** * Period in milliseconds for repeating tasks. A positive ...

  6. Java日志记录的事儿

    一.java日志组件 1.common-logging common-logging是apache提供的一个通用的日志接口.用户可以自由选择第三方的日志组件作为具体实现,像log4j,或者jdk自带的 ...

  7. HDU 4496 D-City(并查集,逆思维)

    题目 熟能生巧...常做这类题,就不会忘记他的思路了... //可以反过来用并查集,还是逐个加边,但是反过来输出...我是白痴.....又没想到 //G++能过,C++却wa,这个也好奇怪呀... # ...

  8. iOS视频录制裁剪合成

    网址链接: 视频裁剪合并:http://blog.sina.com.cn/s/blog_64ea868501018jx3.html 视频之定义裁剪高宽度:http://www.cocoachina.c ...

  9. CSS Animatie是一款在线制作CSS3动画的工具,可以在线直接制作CSS3动画效果,生成代码

    CSS Animatie是一款在线制作CSS3动画的工具,可以在线直接制作CSS3动画效果,生成代码 CSS Animatie 彩蛋爆料直击现场 CSS Animatie是一款在线制作CSS3动画的工 ...

  10. SqlServer 常用

    Sql的函数 newId() 获得guid: getDatatime() 获得当前时间: Row_number() 分页常用的函数. 比top 好用的函数select  Row_Number() ov ...