Codeforces Round #439 (Div. 2)【A、B、C、E】
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】的更多相关文章
- Codeforces Round #443 (Div. 2) 【A、B、C、D】
Codeforces Round #443 (Div. 2) codeforces 879 A. Borya's Diagnosis[水题] #include<cstdio> #inclu ...
- 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. 题解:答案就是 ...
- Codeforces Round #441 (Div. 2)【A、B、C、D】
Codeforces Round #441 (Div. 2) codeforces 876 A. Trip For Meal(水题) 题意:R.O.E三点互连,给出任意两点间距离,你在R点,每次只能去 ...
- Codeforces Round #436 (Div. 2)【A、B、C、D、E】
Codeforces Round #436 (Div. 2) 敲出一身冷汗...感觉自己宛如智障:( codeforces 864 A. Fair Game[水] 题意:已知n为偶数,有n张卡片,每张 ...
- Codeforces Round #435 (Div. 2)【A、B、C、D】
//在我对着D题发呆的时候,柴神秒掉了D题并说:这个D感觉比C题简单呀!,,我:[哭.jpg](逃 Codeforces Round #435 (Div. 2) codeforces 862 A. M ...
- Codeforces Round #440 (Div. 2)【A、B、C、E】
Codeforces Round #440 (Div. 2) codeforces 870 A. Search for Pretty Integers(水题) 题意:给两个数组,求一个最小的数包含两个 ...
- Codeforces Round #439 (Div. 2) 题解
题目链接 Round 439 div2 就做了两道题TAT 开场看C题就不会 然后想了好久才想到. 三种颜色挑出两种算方案数其实是独立的,于是就可以乘起来了. E题想了一会有了思路,然后YY出了一种 ...
- 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.直接暴力判断即 ...
- 【Codeforces Round #439 (Div. 2) C】The Intriguing Obsession
[链接] 链接 [题意] 给你3种颜色的点. 每种颜色分别a,b,c个. 现在让你在这些点之间加边. 使得,同种颜色的点之间,要么不连通,要么连通,且最短路至少为3 边是无向边. 让你输出方案数 [题 ...
随机推荐
- IOS多选单选相册图片
之前做项目让实现多选相册的图片,自己写了一个demo一直保存在电脑上,今天下午发现电脑128G的容量已经快没有了,准备清理电脑,所以把之前做的一些demo放在博客上,以后方便用. 1.首先准备3个图片 ...
- C# 条码生成类
using System.Collections; using System.Text.RegularExpressions; namespace DotNet.Utilities { public ...
- Win7系统服务优化完全攻略
前文提到Windows系统启动的原理,其中加载各项系统服务是影响系统启动时间的重要因素,之前软媒在Win7之家(http://www.win7china.com/)和Vista之家(http:// ...
- 利用QVOD架设流媒体服务器/电影服务器/vod服务器
电影服务器一点也不稀罕,是的我们见的太多了,但是大家有没有想过自己也能架一个这样的服务器? 当然现在架一个电影服务器不切实际,去年吵的闹哄哄的“视听许可证”想必大家有所耳闻,再加上电影对服务器的要求一 ...
- apache2.4和2.2 的一些区别
指令的一些差异 其中的一些指令已经无效,如: Order Deny,Allow Deny from all Allow from all 取而代之的是: Deny from all 变成 Re ...
- 学习Golang的步骤建议
一.快速入门 通过快速入门可以宏观的了解Go相关知识.快速入门可以去学习 go-tour 国内可以访问的中文版的 go-tour 地址有下面一些: http://gotour.qizhanming.c ...
- K:栈和队列的比较
栈和队列的相同点: 都是线性结构,即数据元素之间具有"一对一"的逻辑关系 都可以在顺序存储结构和链式存储结构上进行实现 在时间代价上,插入和删除操作都需常数时间:在空间代价上,情况 ...
- Java 并发:Executor
异常捕获 以前使用executor的时候,为了记录任务线程的异常退出会使用ThreadFactory来设置线程的UncaughtExceptionHandler,但是按照书上的验证发现,采用execu ...
- JS求一个数组元素的最小公倍数
求几个数的最小公倍数就是先求出前两个数的最小公倍数,然后再把这个最小公倍数跟第三个数放在一起来求最小公倍数,如此类推... var dbList = []; //两个数的最小公倍数 function ...
- Catalan数的通项公式(母函数推导)
首先 \[h_n=\sum_{i}h_ih_{n-i-1}\] 写出 \(h\) 的母函数 \(H(x)\) 那么 \[H(x)=H^2(x)x+1,H(x)=\frac{1-\sqrt{1-4x}} ...