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 ...
随机推荐
- On Explainability of Deep Neural Networks
On Explainability of Deep Neural Networks « Learning F# Functional Data Structures and Algorithms is ...
- fiddler 代理不成功调试
按照 http://jingyan.baidu.com/article/03b2f78c7b6bb05ea237aed2.html 设置. 之前可以用, 现在不能用. 1. 关闭 系统防火墙 2. 换 ...
- QGraphics
QGraphicsView和QGraphicsScene QGraphicsScene提供一个场景,可以添加各种item,QGraphicsView用于将元素显示,并支持旋转和缩放:可以将QGraph ...
- eclipse运行WordCount
1) 可以完全参考http://www.cnblogs.com/archimedes/p/4539751.html在eclipse下创建MapReduce工程,创建了MR工程,并完成WordCount ...
- acdream1116 Gao the string!(扩展KMP)
今天是字符串填坑的一天,首先填的第一个坑是扩展KMP.总结一下KMP和扩展KMP的区别. 在这里s是主串,t是模式串. KMP可以求出的是以s[i]为结尾的串和 t前缀匹配的最长的长度.假如这个长度是 ...
- POJ3469 Dual Core CPU(最小割)
题意:给你n个模块,每个模块在A核花费为ai,在B核跑花费为bi,然后由m个任务(ai,bi,wi),表示如果ai,bi不在同一个核上跑,额外的花费为wi,求最小的花费. 一开始想的时候以为是费用流, ...
- codeforces 425A Sereja and Swaps(模拟,vector,枚举区间)
题目 这要学习的是如何枚举区间,vector的基本使用(存入,取出,排序等),这题的思路来自: http://www.tuicool.com/articles/fAveE3 //vector 可以用s ...
- Win7系统配置IIS7服务
1.开启IIS7服务 打开控制面板,选择并进入“程序”,双击“打开或关闭Windows服务”,在弹出的窗口中选择“Internet信息服务”下面所有地选项,点击确定后,开始更新服务. 2.安装web文 ...
- 如何修改Linux系统的TTL值
在网络中,黑客如果用ping命令去探测 一个主机,根据TTL基数可以推测操作系统的类型.对于一个没有经过任何网关和路由的网络, 直接ping对方系统得到的TTL值,被叫做"TTL基数&qu ...
- lintcode:线段树的查询
线段树的查询 对于一个有n个数的整数数组,在对应的线段树中, 根节点所代表的区间为0-n-1, 每个节点有一个额外的属性max,值为该节点所代表的数组区间start到end内的最大值. 为Segmen ...