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. OpenStack 组成 架构

    Components of OpenStack OpenStack is on a mission: to provide scalable, elastic cloud computing for ...

  2. [转]Calling an OData Service From a .NET Client (C#)

    本文转自:https://docs.microsoft.com/en-us/aspnet/web-api/overview/odata-support-in-aspnet-web-api/odata- ...

  3. c# 旋转图片 无GDI+一般性错误

    using (System.Drawing.Bitmap backgroudImg = System.Drawing.Bitmap.FromFile(DoubleClickPicInfo.FileNa ...

  4. Spring MVC 实现Excel的导入导出功能(1:Excel的导入)

    简介 这篇文章主要记录自己学习上传和导出Excel时的一些心得,企业办公系统的开发中,经常会收到这样的需求:批量录入数据.数据报表使用 Excel 打开,或者职能部门同事要打印 Excel 文件,而他 ...

  5. Java Swing实战(四)按钮组件JButton及其事件监听

    接下来为面板添加保存按钮,并为按钮绑定事件监听. /** * @author: lishuai * @date: 2018/11/26 13:51 */ public class WeimingSyn ...

  6. 对JDK、JRE和JVM的一些浅薄理解

    JDK:JDK(Java Development Kit),顾名思义是java程序的开发包,任何java程序想要运行都需要相应版本的JDK,可以到oracle下载(下载之后自带JRE和编译工具等,无需 ...

  7. MySQL Community Server 5.5.56 ZIP Archive 绿色解压版 window安装步骤

    MySQL Community Server 5.5.56  ZIP Archive  绿色解压版 window安装步骤 首先 准备好启动配置文件my.ini [mysqld] #设置字符集为utf8 ...

  8. 关于modelmap.addAttribute("",)转到jsp页面获取不到值的问题

    问题一,可能是你设置的web.xml的头有问题 掉坑里好一会,发现我默认生成的web.xml中头部的配置是 <!DOCTYPE web-app PUBLIC "-//Sun Micro ...

  9. 安卓app开发-02-安卓app快速开发

    安卓app开发-02-安卓app快速开发 上一篇介绍了安卓 app 开发的工具和环境配置,本篇不涉及编程技术,适合小团队快速高效开发 APP制作流程 当有一个APP创意,该如何实现呢?是花数十万找AP ...

  10. weex常用属性梳理

    之前发了一篇weex集成和开发的博客,主要是讲了weex开发环境的搭建和文件的编译.部署,还有就是一些个人对weex的理解,最近将原生的项目改造成weex的项目,也持续了有两个多月的时间了,后面我会发 ...