Codeforces Round #240 (Div. 2) 题解
A: 1分钟题,往后扫一遍
int a[MAXN];
int vis[MAXN];
int main(){
int n,m;
cin>>n>>m;
MEM(vis,);
for(int i = ; i <= m ; i++) {
cin>>a[i];
for(int j = a[i] ; j <= n ; j++){
if(vis[j] == ){
vis[j] = a[i];
}
}
}
for(int i = ; i <= n ; i++){
cout<<vis[i]<<" ";
}cout<<endl;
return ;
}
B: 给a,b,n...求x<=n 且floor(x*a/b)最大时的,x的最大值 3分钟题
int x[MAXN];
int main(){
LL n,a,b;
cin>>n>>a>>b;
for(int i = ; i < n ; i++){
cin>>x[i];
LL p = (x[i]*a)/b;
if((p*b)%a == ){
cout<<x[i]-(p*b)/a<<" ";
}else
cout<<x[i]-(p*b)/a-<<" ";
}
cout<<endl; return ;
}
C: 各种特判...前两个保证是x和2x,剩下的自然gcd全是1就行了..那么显然相邻的gcd一定是1...wa了3次我太蠢了
int main(){
int n,k;
while(cin>>n>>k){
int m = n/;
if(n == && k == ){
cout<<""<<endl;
continue;
}
if(m > k || n == || k == ){
cout<<"-1"<<endl;
continue;
}
int x = k-m+;
int y = x*;
cout<<x<<" "<<y<<" ";
int cnt = ;
for(int i = ; i < m- ; i++){
while(cnt == x || cnt+ == x || cnt == y || cnt+ == y) cnt++;
cout<<cnt<<" "<<cnt+<<" ";
cnt+=;
}
while(cnt == x || cnt+ == x || cnt == y || cnt+ == y) cnt++;
if(n% == ) cout<<cnt<<endl;
else cout<<endl;
}
return ;
}
D: dp , dp[i][j] 表示 第i位为j的 方案数 那么类似素数筛搞一遍, 每个状态只能由i-1且为j的约数 转移过来...打一下就是O(n^2lnn)
LL dp[][];
int main(){
int n,k;
while(cin>>n>>k){
MEM(dp,);
for(int i = ; i <= n ; i++){
dp[][i] = ;
}
for(int i = ; i <= k ; i++){
for(int j = ; j <= n ; j++){
for(int x = j ; x <= n ; x+=j){
dp[i][x] = (dp[i][x] + dp[i-][j]) % MOD;
}
}
}
LL res = ;
for(int i = ; i <= n ; i++){
res = (res + dp[k][i])% MOD;
}
cout<<res<<endl;
}
return ;
}
E: 并归搞吧...还有直接暴力sort过的...CF机器真快...todo一下
+182...偶尔爆发一下...
Codeforces Round #240 (Div. 2) 题解的更多相关文章
- Codeforces Round #182 (Div. 1)题解【ABCD】
Codeforces Round #182 (Div. 1)题解 A题:Yaroslav and Sequence1 题意: 给你\(2*n+1\)个元素,你每次可以进行无数种操作,每次操作必须选择其 ...
- Codeforces Round #608 (Div. 2) 题解
目录 Codeforces Round #608 (Div. 2) 题解 前言 A. Suits 题意 做法 程序 B. Blocks 题意 做法 程序 C. Shawarma Tent 题意 做法 ...
- Codeforces Round #525 (Div. 2)题解
Codeforces Round #525 (Div. 2)题解 题解 CF1088A [Ehab and another construction problem] 依据题意枚举即可 # inclu ...
- Codeforces Round #528 (Div. 2)题解
Codeforces Round #528 (Div. 2)题解 A. Right-Left Cipher 很明显这道题按题意逆序解码即可 Code: # include <bits/stdc+ ...
- Codeforces Round #466 (Div. 2) 题解940A 940B 940C 940D 940E 940F
Codeforces Round #466 (Div. 2) 题解 A.Points on the line 题目大意: 给你一个数列,定义数列的权值为最大值减去最小值,问最少删除几个数,使得数列的权 ...
- Codeforces Round #677 (Div. 3) 题解
Codeforces Round #677 (Div. 3) 题解 A. Boring Apartments 题目 题解 简单签到题,直接数,小于这个数的\(+10\). 代码 #include &l ...
- Codeforces Round #665 (Div. 2) 题解
Codeforces Round #665 (Div. 2) 题解 写得有点晚了,估计都官方题解看完切掉了,没人看我的了qaq. 目录 Codeforces Round #665 (Div. 2) 题 ...
- Codeforces Round #160 (Div. 1) 题解【ABCD】
Codeforces Round #160 (Div. 1) A - Maxim and Discounts 题意 给你n个折扣,m个物品,每个折扣都可以使用无限次,每次你使用第i个折扣的时候,你必须 ...
- Codeforces Round #383 (Div. 2) 题解【ABCDE】
Codeforces Round #383 (Div. 2) A. Arpa's hard exam and Mehrdad's naive cheat 题意 求1378^n mod 10 题解 直接 ...
随机推荐
- ZOJ 3369 Saving Princess
Saving Princess Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged on ZJU. Origina ...
- 兼顾php和jquery新版本的checkbox的写法
<input type="checkbox" class="scate_item" name="scategories[]" valu ...
- MongoDB查询、索引和聚合
初始化mongodb数据库 > use deng switched to db deng > db.createCollection("jingdong") #无參数 ...
- 关于oracle db 11gR2版本号上的_external_scn_rejection_threshold_hours參数和scn headroom补丁问题
关于oracle db 11gR2版本号上的_external_scn_rejection_threshold_hours參数和scn headroom补丁问题 来自于: Installing, Ex ...
- MPI搭建简要教程
具体安装部署,能够參考 http://www.ibm.com/developerworks/cn/linux/l-cn-mpich2/,该教程将的比較具体. 注:不同版本号的 MPICH2对编译器以及 ...
- zookeeper的理解与概述
文章转自https://www.cnblogs.com/likehua/p/3999600.html 感谢博主 文章转自:http://www.aboutyun.com/thread-9266-1- ...
- [Atcoder Grand 006 C] Rabbit Exercise 解题报告 (期望)
题目链接:https://www.luogu.org/problemnew/show/AT2164 https://agc006.contest.atcoder.jp/tasks/agc006_c 题 ...
- oracle(sql)基础篇系列(四)——数字字典、索引、序列、三范式
数字字典表 --查看当前用户下面有哪些张表 select * from user_tables; select table_name from user_tables; --查看当前用户下面有哪些视图 ...
- 使用WinNTSetup安装win10时提示efi part有红叉(win10安装UEFI系统安装)
1.装载ImDisk虚拟磁盘 2.格式化硬盘 *格式化时注意”创建新ESP分区 3.使用 WinNTSetup 选择win10安装程序 *1. “BOOTMGR PBR "后有感叹号不用管, ...
- windows server 2012安装.NET3.5安装提示需要指定源路径 安装.net3.5提示安装不成功,提示需要指定源路径。
安装.net3.5提示安装不成功,提示需要指定源路径. 正确的操作步骤: 1.需要下载windows server 2012操作系统盘.用解压工具解压出来. 2012操作系统下载地址: ...