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的更多相关文章

  1. 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 ...

  2. cf之路,1,Codeforces Round #345 (Div. 2)

     cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....   ...

  3. cf Round 613

    A.Peter and Snow Blower(计算几何) 给定一个点和一个多边形,求出这个多边形绕这个点旋转一圈后形成的面积.保证这个点不在多边形内. 画个图能明白 这个图形是一个圆环,那么就是这个 ...

  4. ARC下OC对象和CF对象之间的桥接(bridge)

    在开发iOS应用程序时我们有时会用到Core Foundation对象简称CF,例如Core Graphics.Core Text,并且我们可能需要将CF对象和OC对象进行互相转化,我们知道,ARC环 ...

  5. [Recommendation System] 推荐系统之协同过滤(CF)算法详解和实现

    1 集体智慧和协同过滤 1.1 什么是集体智慧(社会计算)? 集体智慧 (Collective Intelligence) 并不是 Web2.0 时代特有的,只是在 Web2.0 时代,大家在 Web ...

  6. 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 ...

  7. 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 ...

  8. Codeforces Round #370 - #379 (Div. 2)

    题意: 思路: Codeforces Round #370(Solved: 4 out of 5) A - Memory and Crow 题意:有一个序列,然后对每一个进行ai = bi - bi  ...

  9. CF #376 (Div. 2) C. dfs

    1.CF #376 (Div. 2)    C. Socks       dfs 2.题意:给袜子上色,使n天左右脚袜子都同样颜色. 3.总结:一开始用链表存图,一直TLE test 6 (1)如果需 ...

随机推荐

  1. 安装aptana插件报Error opening the editor. java.lang.NullPointerException

    Aptana的官方网站下载eclipse的插件:  http://update.aptana.com/update/studio/3.2/ ,可以在线安装也可以下载插件后再安装,我是以在线的形式安装的 ...

  2. eclipse+PyDev 中报错"scrapy.spiders.Spider" ,可用"# @UndefinedVariable"压制.

    # -*- coding:utf-8 -*- ''' Created on 2015年10月22日 (1.1) 例子来源: http://scrapy-chs.readthedocs.org/zh_C ...

  3. POJ 3254 Corn Fields(DP + 状态压缩)

    题目链接:http://poj.org/problem?id=3254 题目大意:Farmer John 放牧cow,有些草地上的草是不能吃的,用0表示,然后规定两头牛不能相邻放牧.问你有多少种放牧方 ...

  4. What are TCHAR, WCHAR, LPSTR, LPWSTR, LPCTSTR (etc.)?

    转自: http://www.codeproject.com/Articles/76252/What-are-TCHAR-WCHAR-LPSTR-LPWSTR-LPCTSTR-etc 解释的超详细!! ...

  5. 配置apache+trac环境

    按照trac官网上的配置始终通不过.仔细看了,原来我们使用的apache版本是2.4的,在2.4中有些directive已经变了. 例如:原来的 Allow from all 现在变成了 Requir ...

  6. 利用iptables来配置linux禁止所有端口登陆和开放指定端口

    from:http://www.myhack58.com/Article/sort099/sort0102/2011/31781.htm 1.关闭所有的 INPUT FORWARD OUTPUT 只对 ...

  7. Python编写的Linux网络设置脚本,Debian Wheezy上测试通过

    hon编写的Linux网络设置脚本,Debian Wheezy上测试通过       阿里百川梦想创业大赛,500万创投寻找最赞的APP 技术细节参见Linux网络设置高级指南 注意事项参见程序注释 ...

  8. 尝试一下用MARKDOWN嵌入代码

    public void test(){ // }

  9. LeetCode【第一题】Two Sum

    准备刷一刷LeetCode了. 题目: ''' Given an array of integers, return indices of the two numbers such that they ...

  10. __construct()和__initialize()

    ThinkPHP中的__initialize()和类的构造函数__construct()网上有很多关于__initialize()的说法和用法,总感觉不对头,所以自己测试了一下.将结果和大家分享.不对 ...