UVa--679 Dropping Balls(模拟)
来源:互联网 发布:北京青少年行知实践 编辑:程序博客网 时间:2024/06/07 06:04
UVa-679
题解:
如果模拟这这所有I个小球的小落,会超时。
直接模拟最后一个小球的路线。
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int main(){ int t, D, I; cin >> t; while(t--) { cin >> D >> I; int k = 1; for(int i = 1; i <= D - 1; ++i) //每次下落一层,除叶子外,一共 D-1 层 { if(I & 1){ k *= 2; I = (I + 1) / 2; } else{ k = 2 * k + 1; I /= 2; } } cout << k << endl; } return 0;}
0 0
- UVa--679 Dropping Balls(模拟)
- UVA 679 Dropping Balls 【模拟+数学规律】
- UVA 679 - Dropping Balls
- uva 679 - Dropping Balls
- UVa 679 Dropping Balls
- UVA - 679 Dropping Balls
- UVa 679 Dropping Balls
- UVa 679 - Dropping Balls
- UVa 679 - Dropping Balls
- UVa 679 - Dropping Balls
- UVa 679 - Dropping Balls
- uva 679 Dropping Balls
- Uva - 679 - Dropping Balls
- UVA 679 - Dropping Balls
- UVa-679 Dropping Balls
- UVa 679 Dropping Balls
- UVa 679 - Dropping Balls
- uva 679 Dropping Balls
- 记录项目中包含的安全问题(st)
- android实现防美拍点赞效果
- HALCON形状匹配讲解
- R语言学习:RStudio安装
- struts2 返回类型
- UVa--679 Dropping Balls(模拟)
- 工作3个月了
- drozer利用可调试APP及jdb远程连接失败的解决办法
- 1070: [SCOI2007]修车
- 自定义Uri启动外部应用
- QT程序自动寻找依赖的DLL(Qt官方开发环境生成的exe发布方式--使用windeployqt)
- 【SSH】之Struts2和MVC对应
- 信必优助力Polar推出Loop健身手环
- Web.xml配置项说明