Codeforces Beta Round #97 (Div. 1)
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)的更多相关文章
- 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 ...
- 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 ...
- Codeforces Beta Round #97 (Div. 1) A. Replacement 水题
A. Replacement 题目连接: http://codeforces.com/contest/135/problem/A Description Little Petya very much ...
- Codeforces Beta Round #97 (Div. 2)
A题求给出映射的反射,水题 #include <cstdio> int x,ans[105],n; int main(){ scanf("%d",&n); fo ...
- Codeforces Beta Round #80 (Div. 2 Only)【ABCD】
Codeforces Beta Round #80 (Div. 2 Only) A Blackjack1 题意 一共52张扑克,A代表1或者11,2-10表示自己的数字,其他都表示10 现在你已经有一 ...
- Codeforces Beta Round #83 (Div. 1 Only)题解【ABCD】
Codeforces Beta Round #83 (Div. 1 Only) A. Dorm Water Supply 题意 给你一个n点m边的图,保证每个点的入度和出度最多为1 如果这个点入度为0 ...
- Codeforces Beta Round #79 (Div. 2 Only)
Codeforces Beta Round #79 (Div. 2 Only) http://codeforces.com/contest/102 A #include<bits/stdc++. ...
- Codeforces Beta Round #77 (Div. 2 Only)
Codeforces Beta Round #77 (Div. 2 Only) http://codeforces.com/contest/96 A #include<bits/stdc++.h ...
- Codeforces Beta Round #76 (Div. 2 Only)
Codeforces Beta Round #76 (Div. 2 Only) http://codeforces.com/contest/94 A #include<bits/stdc++.h ...
随机推荐
- [百度空间] [转]将程序移植到64位Windows
from : http://goooder.bokee.com/2000373.html (雷立辉 整理) 简介:本文对如何将32位Windows程序平滑的支持和过渡到64位Windows操作系统做出 ...
- css两个form不换行,两个div并排代码
1.form不换行通过table布局实现 <table> <tr> <td> <form method="get" action=&quo ...
- iOS第三方(显示视图的宽度高度)- MMPlaceHolder
github:https://github.com/adad184/MMPlaceHolder#readme appDelegate添加,影响全局 [MMPlaceHolderConfig defau ...
- 历代诗词咏宁夏注释1----常星景:< 六盘>
六盘 常星景 关中形势甲天下,四岳分峙西太华.[1] 中有汭泾经纬之,六盘嵚崎历历落.[2] □□□□其流亚,终年峰头雪不消. 弟畜太白兒美高,眼底培缕纷纷何足数,呼吸想通天尺五.[3] 西北堆镇一切 ...
- SiteView
http://www.siteview.com/cms/sites/public/home.html
- Windows服务创建及安装
Windows服务创建及安装http://www.cnblogs.com/tuyile006/archive/2006/11/27/573654.html
- 自制 JS.format带分页索引
//第一参数是:Json对象,第二个是 序号 第三个 页数 第四 当前页数String.prototype.format = function (args, sid, pagesi ...
- 妙味课堂——HTML+CSS(第四课)(一)
这一课学的东西真是太多了,还不赶快记下来,留待以后慢慢回味! 首先我们回顾一下inline-block的特性: 使块元素在一行显示 使内嵌支持宽高 换行被解析了(问题) 不设置宽度的时候,宽度由内容撑 ...
- c# 委托 和 事件
当初学C#的时候,没有完全吃透的,只能现在继续了... 欠老账.... http://www.cnblogs.com/chengxingliang/archive/2013/05/21/305191 ...
- 面向 Java 开发人员的 Ajax: 构建动态的 Java 应用程序
面向 Java 开发人员的 Ajax: 构建动态的 Java 应用程序 Ajax 为更好的 Web 应用程序铺平了道路 在 Web 应用程序开发中,页面重载循环是最大的一个使用障碍,对于 Java™ ...