CF 370
A:http://codeforces.com/problemset/problem/370/A
#include<stdio.h>
#include<string.h>
#include<cmath>
#include<algorithm>
using namespace std; int main()
{
int chess[][];
memset(chess,,sizeof(chess));
for(int i = ; i <= ; i+=)
{
for(int j = ; j <= ; j+=)
chess[i][j] = ;
}
for(int i = ; i <= ; i += )
{
for(int j = ; j <= ; j+=)
chess[i][j] = ;
}
int r1,c1,r2,c2;
int ans1,ans2,ans3;
while(~scanf("%d %d %d %d",&r1,&c1,&r2,&c2))
{
if(r1 == r2 && c1 == c2)
{
printf("0 0 0\n");
continue;
}
if(r1 == r2 || c1 == c2)
ans1 = ;
else ans1 = ; if(chess[r1][c1] == chess[r2][c2])
{
if(abs(r1-r2) == abs(c1-c2))
ans2 = ;
else ans2 = ;
}
else ans2 = ; ans3 = max(abs(r1-r2),abs(c1-c2));
printf("%d %d %d\n",ans1,ans2,ans3);
}
return ;
}
B:http://codeforces.com/problemset/problem/370/B
如果第i个是第j个的子集,第j个输出NO,如果没有任何一个集合是第j个的子集,输出YES
#include<stdio.h>
#include<string.h>
int main()
{
int a[][];
int cnt[],x,n;
while(~scanf("%d",&n))
{
memset(a,,sizeof(a));
for(int i = ; i < n; i++)
{
scanf("%d",&cnt[i]);
for(int j = ; j < cnt[i]; j++)
{
scanf("%d",&x);
a[i][x]++;
}
} for(int i = ; i < n; i++)
{
int flag = ;
for(int j = ; j < n && flag; j++)
{
if(i == j) continue;
flag = ;
for(int k = ; k <= &&!flag; k++)
{
if(a[j][k] && !a[i][k])
flag = ;
}
}
if(flag)
printf("YES\n");
else printf("NO\n");
}
}
return ;
}
CF 370的更多相关文章
- ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'
凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- cf Round 613
A.Peter and Snow Blower(计算几何) 给定一个点和一个多边形,求出这个多边形绕这个点旋转一圈后形成的面积.保证这个点不在多边形内. 画个图能明白 这个图形是一个圆环,那么就是这个 ...
- ARC下OC对象和CF对象之间的桥接(bridge)
在开发iOS应用程序时我们有时会用到Core Foundation对象简称CF,例如Core Graphics.Core Text,并且我们可能需要将CF对象和OC对象进行互相转化,我们知道,ARC环 ...
- [Recommendation System] 推荐系统之协同过滤(CF)算法详解和实现
1 集体智慧和协同过滤 1.1 什么是集体智慧(社会计算)? 集体智慧 (Collective Intelligence) 并不是 Web2.0 时代特有的,只是在 Web2.0 时代,大家在 Web ...
- CF memsql Start[c]UP 2.0 A
CF memsql Start[c]UP 2.0 A A. Golden System time limit per test 1 second memory limit per test 256 m ...
- CF memsql Start[c]UP 2.0 B
CF memsql Start[c]UP 2.0 B B. Distributed Join time limit per test 1 second memory limit per test 25 ...
- Codeforces Round #370 - #379 (Div. 2)
题意: 思路: Codeforces Round #370(Solved: 4 out of 5) A - Memory and Crow 题意:有一个序列,然后对每一个进行ai = bi - bi ...
- CF #376 (Div. 2) C. dfs
1.CF #376 (Div. 2) C. Socks dfs 2.题意:给袜子上色,使n天左右脚袜子都同样颜色. 3.总结:一开始用链表存图,一直TLE test 6 (1)如果需 ...
随机推荐
- html元素
类型 HTML元素 描述 主窗体元素 <HTML></HTML> 超文本的开始和结束 <HEAD></HEAD> 超文本信息头的开始和结束 <TI ...
- iOS 查找字符串 相同 子字符串的位置 range
问题:解决替换同一个字符串的多个相同的字符eg. xxx这个超级大土豪白送xxx一个!赶快来抢把! 将第一个xxx换成名字 将第二个xxx换成物品 两种办法 第二种办法更灵活一点 //第一种办法 ...
- c语言全局变量与局部变量(当变量重名时)的使用情况
在c语言中,变量有全局变量和局部变量之分,这一点和很多高级语言类似,如c#,java等.不过与c#,java中的局部变量如在全局变量作用域内则不允许与全局变量名相同,而c语言是允许这样做的.这样的做法 ...
- javee学习-通过ServletContext对象实现数据共享
1,设置值. ServletContext context = this.getServletConfig().getServletContext();//获得ServletContext对象 // ...
- ios 64位下编译webrtc的libvpx库出现错误Bad cputype for object file.Currently only tested for CPU_TYPE_x86_64
diff --git a/libvpx.gyp b/libvpx.gypindex 4f8cb2b..4eb6866 100644--- a/libvpx.gyp+++ b/libvpx.gyp@@ ...
- OpenJudge/Poj 1657 Distance on Chessboard
1.链接地址: http://bailian.openjudge.cn/practice/1657 http://poj.org/problem?id=1657 2.题目: 总时间限制: 1000ms ...
- android 开源框架推荐
同事整理的 android 开源框架,个个都堪称经典.32 个赞! 1.volley 项目地址 https://github.com/smanikandan14/Volley-demo (1) JS ...
- 【原创】Linux 内核模块编程
sudo gedit hello.c #include <linux/module.h> #include <linux/kernel.h> #include <linu ...
- 安装交叉编译arm-linux-gcc环境
设置好交叉编译的执行文件路径贴加到环境变量PATH 设置如下 export PATH=$PATH:/XXX/XXX/bin /etc/profile /~/.bashrc source /etc/p ...
- 系统监控的一些工具w , vmstat
w 命令:--w 查看的是系统整体上的负载 # w 15:23:46 up 3:34, 2 users, load average: 0.03, 0.05, 0.00 USER TTY FROM LO ...