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)如果需 ...
随机推荐
- WORDPRESS 后台500错误解决方法集合
引自: http://www.guuglc.com/565.html 这篇文章本质上我是不可能会写到,就因为7号那天晚上,我准备搬家的时候,发现前台完好,进入后台却500错误. 这时我就得急的,毕竟明 ...
- 关于ligerui 中 grid 表格的扩展搜索功能在远程数据加载时无法使用的解决办法
要想使用grid里的扩展搜索功能,除了要引用ligerui主要的js文件外,还必须引入下面的JS文件: 1.Source\demos\filter\ligerGrid.showFilter.js 2. ...
- 【转】浅析Windows编程的剪贴板
摘要: 本文对Windows剪贴板机制作了深入.全面的阐述,具体内容包括:文本.位图.DSP.自定义格式剪贴板的使用和多数据项和延迟提交技术. 关键词: VC++6.0: 剪贴板机制:数据格式:延迟提 ...
- JavaScript高级程序设计(四): 关键字With的使用
一.关键字with 1.含义 with 语句可以方便地用来引用某个特定对象中已有的属性,但是不能用来给对象添加属性.要给对象创建新的属性,必须明确地引用该对象. 简单的说,with为一个或一 ...
- iOS 获取当前媒体音量
#import <AVFoundation/AVAudioSession.h> AVAudioSession *audioSession = [AVAudioSession sharedI ...
- itoa 和_itoa_s
1> itoa, 将整数转换为字符串. char * itoa ( int value, char * buffer, int radix ); 它包含三个参数: value, 是要转换的数字 ...
- Python之实现一个简易计算器
自己动手写计算器 一.功能分析 用户输入一个类似这样 3*( 4+ 50 )-(( 100 + 40 )*5/2- 3*2* 2/4+9)*((( 3 + 4)-4)-4) 这样的表达式,假设表达式里 ...
- tp_shop解读1
由于想弄一个商城,因此研究了一下tp_shop,这个据说能完成几乎所有的功能. 考虑到原有的例子过于复杂,因此把所有相关的数据都删除了,结果上来就出错了,查了两天,大致弄清楚了状况. 关于错误的原因 ...
- 高性能、高并发TCP服务器(多线程调用libevent)
from:http://blog.csdn.net/i_am_jojo/article/details/7587838 本文讲述的TCP服务器是模仿memcache中的TCP网络处理框架,其中是基于l ...
- AMAZON PRICE TRACKER, AMAZON PRICE HISTORY, AMAZON PRICE DROP ALERT | DROPGG.COM
DropGG.com is the destination for savvy shoppers looking to save money by buying smart. DropGG.com a ...