Codeforces Round #439 (Div. 2)

codeforces 869 A. The Artful Expedient

看不透(

 #include<cstdio>
int main(){
puts("Karen");
return ;
}

15ms

codeforces 869B. The Eternal Immortality(数学,水)

题意:输出两个数的阶乘的商的 个位数

题解:两数之差大于5,个位数就是0。小于5直接个位相乘即可。

 #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
int main(){
ll a, b, x, y;
scanf("%lld %lld", &a, &b);
if(b-a>=) puts("");
else {
ll d = b - a; ll t = ;
x = b % ;
for(int i = ; i < d; ++i) t *= (x-i);
printf("%lld\n", t%);
}
return ;
}

15ms

codeforces 869 C. The Intriguing Obsession(组合数)

题意:给出三种颜色岛屿的数量,问有多少种建桥方法。限制是:对于相同颜色的岛屿,要么不联通,要么最少相距为3。

 #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll mod = ;
const int N = ;
ll c[N][N];
void init() {
int i, j;
for(i = ; i < N; ++i) c[][i] = ;
for(i = ; i < N; ++i)
for(j = i; j < N; ++j)
c[i][j]=(c[i-][j]+c[i-][j-]*j)%mod;
}
int main() {
init();
int x, y, z;
scanf("%d%d%d", &x, &y, &z);
if(x>y)swap(x, y); if(x>z)swap(x, z); if(y>z)swap(y,z);
printf("%lld\n", (((c[x][y]*c[x][z])%mod)*c[y][z])%mod );
return ;
}

140ms

codeforces 869 E. The Untended Antiquity(暴力差分)

题意:给一个n行m列的方格矩形,每格是1*1的单元,有q个操作:t, r1, c1, r2, c2其中t=1表示 以(r1,c1)和(r2,c2)为矩形对角线端点选择相应的矩形平面,在其 边界 放障碍物;t=2同理移除该矩形 边界的障碍物;t=3表示 求(r1,c1)能否到达(r2,c2),要求行走时不能通过障碍物。

//不会,,先留着。。

 题解:看别人做的这题暴力居然能卡过去,神奇,学习了。

给矩形边界移除和放障碍物时依次给每一行的矩形列首尾打标记,查询时,根据点所在的那行信息,判断两点是否在同一区域,即可判断两点是否互相可达。

 #include<algorithm>
#include<cstdio>
#include<iostream>
using namespace std;
inline void read(int&a){char c;while(!(((c=getchar())>='')&&(c<='')));a=c-'';while(((c=getchar())>='')&&(c<=''))(a*=)+=c-'';}
const int N = ;
int mp[N][N];
int fun(int r, int c) {
int top = ;
for(int i = c; i >= ; --i) {
if(mp[r][i] > ) {
if(!top) return mp[r][i];
else top++;
}
else if(mp[r][i] < ) top--;
}
return ;
}
int main() {
int n, m, q, i, j;
int t, r1, c1, r2, c2;
read(n); read(m); read(q);
for(j = ; j <= q; ++j) {
read(t); read(r1); read(c1); read(r2); read(c2);
if(t==) {
for(i = r1; i <= r2; ++i) {
mp[i][c1] = j; mp[i][c2+] = -;
}
}else if(t == ) {
for(i = r1; i <= r2; ++i) {
mp[i][c1] = mp[i][c2+] = ;
}
}else {
if(fun(r1, c1)==fun(r2, c2)) puts("Yes"); else puts("No");
}
}
return ;
}

1887ms

Codeforces Round #439 (Div. 2)【A、B、C、E】的更多相关文章

  1. Codeforces Round #443 (Div. 2) 【A、B、C、D】

    Codeforces Round #443 (Div. 2) codeforces 879 A. Borya's Diagnosis[水题] #include<cstdio> #inclu ...

  2. Codeforces Round #434 (Div. 2)【A、B、C、D】

    Codeforces Round #434 (Div. 2) codeforces 858A. k-rounding[水] 题意:已知n和k,求n的最小倍数x,要求x后缀至少有k个0. 题解:答案就是 ...

  3. Codeforces Round #441 (Div. 2)【A、B、C、D】

    Codeforces Round #441 (Div. 2) codeforces 876 A. Trip For Meal(水题) 题意:R.O.E三点互连,给出任意两点间距离,你在R点,每次只能去 ...

  4. Codeforces Round #436 (Div. 2)【A、B、C、D、E】

    Codeforces Round #436 (Div. 2) 敲出一身冷汗...感觉自己宛如智障:( codeforces 864 A. Fair Game[水] 题意:已知n为偶数,有n张卡片,每张 ...

  5. Codeforces Round #435 (Div. 2)【A、B、C、D】

    //在我对着D题发呆的时候,柴神秒掉了D题并说:这个D感觉比C题简单呀!,,我:[哭.jpg](逃 Codeforces Round #435 (Div. 2) codeforces 862 A. M ...

  6. Codeforces Round #440 (Div. 2)【A、B、C、E】

    Codeforces Round #440 (Div. 2) codeforces 870 A. Search for Pretty Integers(水题) 题意:给两个数组,求一个最小的数包含两个 ...

  7. Codeforces Round #439 (Div. 2) 题解

    题目链接  Round 439 div2 就做了两道题TAT 开场看C题就不会 然后想了好久才想到. 三种颜色挑出两种算方案数其实是独立的,于是就可以乘起来了. E题想了一会有了思路,然后YY出了一种 ...

  8. Codeforces Round #430 (Div. 2) 【A、B、C、D题】

    [感谢牛老板对D题的指点OTZ] codeforces 842 A. Kirill And The Game[暴力] 给定a的范围[l,r],b的范围[x,y],问是否存在a/b等于k.直接暴力判断即 ...

  9. 【Codeforces Round #439 (Div. 2) C】The Intriguing Obsession

    [链接] 链接 [题意] 给你3种颜色的点. 每种颜色分别a,b,c个. 现在让你在这些点之间加边. 使得,同种颜色的点之间,要么不连通,要么连通,且最短路至少为3 边是无向边. 让你输出方案数 [题 ...

随机推荐

  1. javascript 基础知识-1

    1, stringObject.charAt(index) : 返回指定位置(index)的字符 2, RegExpObject.exec(string), 用于检索字符串(string)中正则表达式 ...

  2. Hadoop源码学习笔记(6)——从ls命令一路解剖

    Hadoop源码学习笔记(6) ——从ls命令一路解剖 Hadoop几个模块的程序我们大致有了点了解,现在我们得细看一下这个程序是如何处理命令的. 我们就从原头开始,然后一步步追查. 我们先选中ls命 ...

  3. POJ 2524(并查集)

    这道题多了一个检查是否包含所有元素 可以设一个cnt表示集合里的数量,再与外面比较 #include <cstdio> #include <iostream> #include ...

  4. 单点登录-SSO

    单点登录 (Single Sign-On ) 1.同域单点登录 登录的时候,设置cookie的域即可. 2.跨域单点登录 重点是,如何在浏览器端保存登录的标识. 祭图:(脑补) 三个系统: a.aaa ...

  5. WinSxS文件夹瘦身

    WinSxS文件夹瘦身 2014-5-8 18:03:32来源:IT之家作者:阿象责编:阿象 评论:27 刚刚,我们分享了如何用DISM管理工具查看Win8.1 WinSxS文件夹实际大小.对于Win ...

  6. 【Angularjs】ng-repeat中使用ng-model遇到的问题

    总结:在ng-repeat中ng-model的问题,原因是ng-model对controller中的$scope是不可见的,所以在使用repeat中的某个对象的属性的时候,最好还是将该对象或者该对象的 ...

  7. js 捕捉回车键触发登录,并验证输入内容

    js 捕捉回车键触发登录,并验证输入内容 有时候我们会遇到 web 页面中捕捉按键,触发一些效果, 比如常见的回车键触发登录,并验证输入内容,下面会介绍,截图: 一.最简单的捕捉回车键:判断按下的是不 ...

  8. 基于Vue的WebApp项目开发(四)

    实现新闻咨询页面 目录结构 步骤一:创建newslist.vue文件 <template> <div id="tml"> <!--使用mui框架,实现 ...

  9. Event percentages解析

    Event percentages: 0:--pct-touch//touch events percentage触摸事件百分比(触摸事件是一个在屏幕单一位置的按下-抬起事件) 1:--pct-mot ...

  10. Python3 中日语料分句实现

    0. 背景 因为最近在看平行语料句对齐.词对齐的缘故,想做对齐的话需要先做一个分句. 一开始利用正则和引号开关标志写了一种方法,中间想到一个小技巧,写出来比较简单通用,想把这一小段代码分享一下. 1. ...