首页 技术 正文
技术 2022年11月23日
0 收藏 320 点赞 2,972 浏览 1882 个字

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

微信扫一扫

支付宝扫一扫

本文网址:https://www.zhankr.net/141865.html

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:877 阅读:6,234
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:806 阅读:4,053
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:566 阅读:4,858
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:732 阅读:4,790
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:5,881
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:3,572
助力内容变现

将您的收入提升到一个新的水平

点击联系客服

在线时间:8:00-16:00

客服电话

400-888-8888

客服邮箱

ceotheme@ceo.com

扫描二维码

关注微信公众号

扫描二维码

手机访问本站