Codeforces Round #240 (Div. 2) A~D
来源:互联网 发布:android vr播放器源码 编辑:程序博客网 时间:2024/04/27 14:49
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int light[200];int main(){int n,m;scanf("%d%d",&n,&m);for(int i=0;i<m;i++){int l;scanf("%d",&l);for(int j=l;j<=n;j++){if(light[j]==0)light[j]=l;}}for(int i=1;i<=n;i++){printf("%d ",light[i]);}putchar(10);return 0;}
精度处理一下。。。。
#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <algorithm>using namespace std;typedef long long int LL;LL w[100100];int main(){int n;LL a,b;cin>>n>>a>>b;for(int i=0;i<n;i++){cin>>w[i];double t=(w[i]*a)/b;w[i]-=(LL)((ceil)((double)t*(double)b/(double)a));}for(int i=0;i<n;i++){cout<<max(0LL,w[i])<<" ";}cout<<endl;return 0;}
#include <iostream>#include <cstring>#include <cstdio>#include <algorithm>using namespace std;int main(){ int n,k; cin>>n>>k; if(n==1) { if(k==0) { puts("1"); } else { puts("-1"); } } else { if(k<n/2) { puts("-1"); } else { int t=k-(n/2-1); printf("%d %d ",t,2*t); int cnt=1; for(int i=1;i<n/2;i++) { printf(" %d %d",900000000+cnt,900000000+cnt+1); cnt+=2; } if(n&1) { printf(" %d",999999999); } putchar(10); } } return 0;}
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef long long int LL;const LL MOD=1000000007;int n,k;LL dp[2200][2200];LL dfs(int a,int len){ if(dp[a][len]!=-1) return dp[a][len]; if(a>n) return dp[a][len]=0; if(len==0) return dp[a][len]=1; LL ret=0; for(int i=a;i<=n;i+=a) { ret=(ret+dfs(i,len-1))%MOD; } return dp[a][len]=ret;}int main(){ cin>>n>>k; LL ret=0; memset(dp,-1,sizeof(dp)); dfs(1,k); cout<<dp[1][k]<<endl; return 0;}
0 0
- Codeforces Round #240 (Div. 2) A~D
- Codeforces Round #209 (Div. 2) <A-D>
- Codeforces Round #231 (Div. 2)A-D
- Codeforces Round #235 (Div. 2) A~D
- Codeforces Round #237 (Div. 2) A~D
- Codeforces Round #239 (Div. 2) A~D
- Codeforces Round #242 (Div. 2) <A-D>
- Codeforces Round #250 (Div. 2) A-D
- Codeforces Round #256 (Div. 2)A-D
- Codeforces Round #263 (Div. 2) A-D
- Codeforces Round #269 (Div. 2) A~D
- Codeforces Round #358 (Div. 2)A~D
- Codeforces Round #359 (Div. 2) A ~D
- Codeforces Round #364 (Div. 2)(A ~ D)
- Codeforces Round #368 (Div. 2) A~D
- Codeforces Round #369 (Div. 2) A~D
- Codeforces Round #369 (Div. 2) A~D
- Codeforces Round #374 (Div. 2) A~D
- java关于多线程的部分操作
- linux中配置oracle11g R2与tomcat先后启动
- jsp速度优化七种方法
- [Unity3D]Unity3D 游戏开发之碰撞检测
- J2ME游戏开发的高级优化技巧
- Codeforces Round #240 (Div. 2) A~D
- 一个离职员工对中兴的回望
- Implicit declaration of function ‘xxxx’ is invalid in C99” 警告的解决办法
- 小时候跟妈妈去外婆的路为什么那么遥远,而今天我几分钟就走了一半--清明节回家记
- sandbox for model
- 通过wifi调试android程序
- Java开发前奏了解Java
- 设计模式学习笔记--享元(Flyweight)模式
- 对企业信息化建设的研究