ARC 058
所以为啥要写来着...........
T1
直接枚举大于等于$n$的所有数,暴力分解判断即可
复杂度$O(10n \log n)$
#include <cstdio>
#include <iostream>
using namespace std; #define sid 15
#define ri register int
int n, k, D[sid]; int main() {
int x, flag;
cin >> n >> k;
for(ri i = ; i <= k; i ++) { cin >> x; D[x] = ; } for(ri i = n; i; i ++) {
x = i; flag = ;
while(x) {
if(D[x % ]) { flag = ; break; }
x /= ;
}
if(!flag)
{ printf("%d\n", i); break; }
}
return ;
}
T2
把第$B$列单独拿出来讨论转移即可
复杂度$O(H)$
#include <cstdio>
#include <iostream>
using namespace std; #define sid 200050
#define ri register int
#define mod 1000000007 int fac[sid], inv[sid];
int H, W, A, B; void Init_C() {
fac[] = fac[] = ; inv[] = inv[] = ;
for(ri i = ; i <= ; i ++) fac[i] = 1ll * fac[i - ] * i % mod;
for(ri i = ; i <= ; i ++) inv[i] = 1ll * (mod - mod / i) * inv[mod % i] % mod;
for(ri i = ; i <= ; i ++) inv[i] = 1ll * inv[i - ] * inv[i] % mod;
} int C(int n, int m) {
if(m > n) return ;
return 1ll * fac[n] * inv[m] % mod * inv[n - m] % mod;
} int way(int x1, int y1, int x2, int y2) {
return C(x2 - x1 + y2 - y1, x2 - x1);
} int main() {
Init_C();
cin >> H >> W >> A >> B;
int ans = , sum = ;
for(ri i = ; i <= H - A; i ++)
ans = (ans + 1ll * way(, , B, i) * way(B + , i, W, H) % mod) % mod;
printf("%d\n", ans);
return ;
}
T3
神奇状压.......
一开始没怎么想直接打了错误的$dp$....没过样例才意识到什么
正着计数不好计数,考虑反面,求解不存在连续区间和为$X, Y, Z$的数量
把$X, Y, Z$状压成为一种状态,当在末尾插入数字时,直接把状态前移,前面的数字会自动前移.....
然后暴力转移即可,复杂度$O(2^{17} * 40)$
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std; #define ri register int
#define mod 1000000007 int bit[];
int N, x, y, z;
int f[][]; int main() {
cin >> N >> x >> y >> z;
for(ri i = ; i <= ; i ++) bit[i] = << i; int ans = ;
for(ri i = ; i <= N; i ++)
ans = 1ll * ans * % mod; f[][] = ;
int gg = bit[z - ] | bit[y + z - ] | bit[x + y + z - ];
int lim = bit[x + y + z] - ; for(ri i = ; i <= N; i ++)
for(ri S = ; S <= lim; S ++)
for(ri v = ; v <= ; v ++) {
int T = (S << v) | bit[v - ]; T &= lim;
if((T & gg) != gg) f[i][T] = (f[i][T] + f[i - ][S]) % mod;
} for(ri S = ; S <= lim; S ++)
if((S & gg) != gg) ans = (ans - f[N][S] + mod) % mod;
printf("%d\n", ans);
return ;
}
T4
留坑...
咕咕咕咕咕咕咕...
ARC 058的更多相关文章
- AtCoder 瞎做
目录 ARC 058 E - 和風いろはちゃん / Iroha and Haiku 题意 题解 技巧 代码 ARC 059 F - バイナリハック / Unhappy Hacking 题意 题解 技巧 ...
- AtCoder Regular Contest
一句话题解 因为上篇AGC的写的有点长……估计这篇也短不了所以放个一句话题解方便查阅啥的吧QwQ 具体的题意代码题解还是往下翻…… ARC 058 D:简单容斥计数. E:用二进制表示放的数字,然后状 ...
- canvas基础绘制-arc
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Convert BSpline Curve to Arc Spline in OpenCASCADE
Convert BSpline Curve to Arc Spline in OpenCASCADE eryar@163.com Abstract. The paper based on OpenCA ...
- 黑马程序员——ARC机制总结和用ARC建立模型
ARC 全称:Automatic Reference Counting 使用ARC 只需要在建立一个新的项目的时候把 下面的√打上 Xcode5以后都会默认建议开发者使用ARC机制 新的项目中如果有部 ...
- JSONKit在项目中使用设置(ARC与方法更新)
在项目中经常会遇到解析json的情况,如果有同学想要解析JSON,那么JSONKit可以是一个不错的选择. git中JSONKit 的地址为:https://github.com/johnezang/ ...
- MRC迁移ARC之__block
今日帮着同事把老项目从MRC迁移至ARC,大部分工作无非是删除release,[super dealloc]等方法,只要关闭了MRC编译选项后,编译器能自动帮你检查,block就有一些不一样了,发现许 ...
- Arc GIS engine10.2与VS2012的安装及匹配步骤
本文章已收录于: .embody { padding: 10px 10px 10px; margin: 0 -20px; border-bottom: solid 1px #ededed } ...
- 关于ARC下需要dealloc的相关内容
今天在项目中使用KVO添加观察者模式的时候,在返回上一级的时候竟然崩了.可是,看了很久,代码没有问题.最后,终于知道了需要添加dealloc 防止以后再出错,所以,便纪录下来.关于ARC下需要手动释放 ...
随机推荐
- [php排错] Forbidden You don't have permission to access / on this server.
刚开始接触PHP,在搭建完环境后发现输入127.0.0.1可以访问界面,但是输入http://localhost却提醒无权访问,在百度之后发现是php中的httpd.conf的作用 在wamp中搜索发 ...
- POJ - 1330 Nearest Common Ancestors 最近公共祖先+链式前向星 模板题
A rooted tree is a well-known data structure in computer science and engineering. An example is show ...
- 2017ACM暑期多校联合训练 - Team 3 1003 HDU 6058 Kanade's sum (模拟)
题目链接 Problem Description Give you an array A[1..n]of length n. Let f(l,r,k) be the k-th largest elem ...
- Daily Report-1126
今日: 上午主要是回顾了react,阅读官方文档的时候发现了list中key值设计的必要性. 看了部分react源码,发现有些吃力,在询问羽牧学长之后调整策略,从redux和mobx入手,先多熟悉用法 ...
- python使用requests模块模拟登陆知乎
from bs4 import BeautifulSoup import requests import time def captcha(captcha_data): with open(" ...
- 大数据系列之kafka监控kafkaoffsetmonitor安装
1.下载kafkaoffsetmonitor的jar包,可以到github搜索kafkaoffsetmonitor,第一个就是,里面可以下载编译好了的包. KafkaOffsetMonitor-ass ...
- ps的各种参数
1.CPU占用最多的前10个进程: ps auxw|head -1;ps auxw|sort -rn -k3|head -10 2.内存消耗最多的前10个进程 ps auxw|head -1;ps a ...
- .pnts点云
一种3d tiles格式 MIME格式: <configuration> <system.webServer> <staticContent> <remove ...
- c++鼠标点点,获取坐标值,放入到txt文件中
// oj3.cpp : Defines the entry point for the console application.// #include "stdafx.h"#in ...
- strptime和strptime函数理解
#include <stdio.h> #include <time.h> int main() { struct tm tm; char buf[255]; strptime( ...