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) 题解的更多相关文章

  1. Codeforces Round #182 (Div. 1)题解【ABCD】

    Codeforces Round #182 (Div. 1)题解 A题:Yaroslav and Sequence1 题意: 给你\(2*n+1\)个元素,你每次可以进行无数种操作,每次操作必须选择其 ...

  2. Codeforces Round #608 (Div. 2) 题解

    目录 Codeforces Round #608 (Div. 2) 题解 前言 A. Suits 题意 做法 程序 B. Blocks 题意 做法 程序 C. Shawarma Tent 题意 做法 ...

  3. Codeforces Round #525 (Div. 2)题解

    Codeforces Round #525 (Div. 2)题解 题解 CF1088A [Ehab and another construction problem] 依据题意枚举即可 # inclu ...

  4. Codeforces Round #528 (Div. 2)题解

    Codeforces Round #528 (Div. 2)题解 A. Right-Left Cipher 很明显这道题按题意逆序解码即可 Code: # include <bits/stdc+ ...

  5. Codeforces Round #466 (Div. 2) 题解940A 940B 940C 940D 940E 940F

    Codeforces Round #466 (Div. 2) 题解 A.Points on the line 题目大意: 给你一个数列,定义数列的权值为最大值减去最小值,问最少删除几个数,使得数列的权 ...

  6. Codeforces Round #677 (Div. 3) 题解

    Codeforces Round #677 (Div. 3) 题解 A. Boring Apartments 题目 题解 简单签到题,直接数,小于这个数的\(+10\). 代码 #include &l ...

  7. Codeforces Round #665 (Div. 2) 题解

    Codeforces Round #665 (Div. 2) 题解 写得有点晚了,估计都官方题解看完切掉了,没人看我的了qaq. 目录 Codeforces Round #665 (Div. 2) 题 ...

  8. Codeforces Round #160 (Div. 1) 题解【ABCD】

    Codeforces Round #160 (Div. 1) A - Maxim and Discounts 题意 给你n个折扣,m个物品,每个折扣都可以使用无限次,每次你使用第i个折扣的时候,你必须 ...

  9. 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 题解 直接 ...

随机推荐

  1. LaTeX 设置字体颜色

    本系列文章由 @YhL_Leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/50240179 需要包含宏包: \use ...

  2. IOS开发-经常使用站点集合

    1.    https://developer.apple.com  //苹果开发人员站点 2.    https://itunesconnect.apple.com  //itunes站点 3.   ...

  3. TOMCATserver不写port号、不写项目名訪问项目、虚拟文件夹配置

    一.不写port. 这个问题都被问烂了.由于TOMCAT默认的訪问port为8080.而TCP/IP协议默认80port訪问,大家之所以看到别的站点都不写port号是由于人家用的的80port訪问的, ...

  4. zzulioj--1832--贪吃的松鼠(位运算好题)

    1832: 贪吃的松鼠 Time Limit: 3 Sec  Memory Limit: 2 MB Submit: 43  Solved: 7 SubmitStatusWeb Board Descri ...

  5. django admin显示多对多字段

    参考文档https://jingyan.baidu.com/article/4e5b3e190f55c591901e24b3.html admin.py from .models import *cl ...

  6. Failed to start metasploit.service: Unit metasploit.service not found的解释

    不多说,直接上干货! root@kali:~# service metasploit start Failed to start metasploit.service: Unit metasploit ...

  7. Activity的启动模式和onNewIntent()

    1:首先,在默认情况下,当您通过Intent启到一个Activity的时候,就算已经存在一个相同的正在运行的Activity,系统都会创建一个新的Activity实例并显示出来.为了不让Activit ...

  8. 请问Typecho Mysql 数据库和Sqlite数据库我该如何选择。

    纠结如我,又纠结了,请大家帮忙看一下我该如何选择.就一个没有文章的博客.一直用VPS太浪费,现在换成了虚拟主机.但是虚拟主机的MYSQL数据库限制连接数30个,我不懂这是个什么概念,但是我觉得30太少 ...

  9. html局部页面打印

    1.局部打印函数. function preview(oper) { if (oper < 10) { bdhtml=window.document.body.innerHTML;//获取当前页 ...

  10. 细说ReactiveCocoa的冷信号与热信号(一)

    热信号:事件触发: 冷信号:订阅出发: 从本质上来说,是信号的存在和产生,是静态信号和动态信号的区别. 背景 ReactiveCocoa(简称RAC)是最初由GitHub团队开发的一套基于Cocoa的 ...