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 题解 直接 ...
随机推荐
- Java基础学习总结(43)——Java8 Lambda揭秘
再了解了Java 8 Lambda的一些基本概念和应用后, 我们会有这样的一个问题: Lambda表达式被编译成了什么?. 这是一个有趣的问题,涉及到JDK的具体的实现. 本文将介绍OpenJDK对L ...
- 2015 Multi-University Training Contest 3 hdu 5323 Solve this interesting problem
Solve this interesting problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ...
- 【甘道夫】Sqoop1.99.3基础操作--导入Oracle的数据到HDFS
第一步:进入clientShell fulong@FBI008:~$ sqoop.sh client Sqoop home directory: /home/fulong/Sqoop/sqoop-1. ...
- 页面头部带loading进度指示的jQuery滚动页面特效
这是一款非常有用且效果非常酷的jQuery页面头部带loading进度指示的滚动页面特效. 该特效在页面滚动的时候页面头部有Loading进度条指示当前页面滚动的位置,这能够让用户知道当前阅读的地方距 ...
- h5 离线存储
- Getting Started with MongoDB (C# Edition)
https://docs.mongodb.com/getting-started/csharp/ 概览 Welcome to the Getting Started with MongoDB guid ...
- android取高度
Rect rect = new Rect(); getWindow().getDecorView().getWindowVisibleDisplayFrame(rect); int top = r ...
- jquery-validator中js校验及标签校验的使用
jquery-validator中js校验及标签校验的使用: 1.项目中引入jquery.validate.js 官方网站:http://bassistance.de/ http://jquery ...
- 射击的乐趣:WIN32诠释打飞机游戏
一楼留给链接http://blog.csdn.net/crocodile__/article/details/11860129 楼上神贴,膜拜片刻...... 一.游戏玩法和已经实现的功能 1.打开游 ...
- Mac上vmware虚拟机Windows10安装JDK8及配置环境
1.jdk8下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html 2.双击下载的jdk进行安装 3.安装成功之 ...