NPOJ 1067 Flappy48
来源:互联网 发布:php strrops 编辑:程序博客网 时间:2024/06/18 04:44
题目大意:中文
注释代码:
/* * Problem ID : NPOJ 1067 Flappy48 * Author : Lirx.t.Una * Language : C++ * Run Time : 1 * Run Memory : 1692 */ #include <iostream>#include <cstdio>#include <map>//最大的方块可能为2^40#defineMAXN41using namespace std;typedeflong longllg;map<llg, llg>score;//score[x]表示方块为x的分数intmain() {intt;//测例数intiscn;inti;//计数变量intn;//每个测例中有几个方块llgx;//方块上的数字llgans;//先对方块2 ~ 2^40的分数进行打表//score[x] = 2score[x/2] + xscore[2LL] = 0;for ( x = 4LL, i = 2; i < MAXN; i++, x <<= 1LL )score[x] = ( score[x >> 1LL] << 1LL ) + x;scanf("%d", &t);iscn = 0;while ( t-- ) {ans = 0;scanf("%d", &n);while ( n-- ) {scanf("%lld", &x);ans += score[x];}printf("Case %d: %lld\n", ++iscn, ans);}return 0;}
无注释代码:
#include <iostream>#include <cstdio>#include <map>#defineMAXN41using namespace std;typedeflong longllg;map<llg, llg>score;intmain() {intt;intiscn;inti;intn;llgx;llgans;score[2LL] = 0;for ( x = 4LL, i = 2; i < MAXN; i++, x <<= 1LL )score[x] = ( score[x >> 1LL] << 1LL ) + x;scanf("%d", &t);iscn = 0;while ( t-- ) {ans = 0;scanf("%d", &n);while ( n-- ) {scanf("%lld", &x);ans += score[x];}printf("Case %d: %lld\n", ++iscn, ans);}return 0;}
0 0
- NPOJ 1067 Flappy48
- NPOJ 1066 找气球
- NPOJ 1058 欢迎新人!
- NPOJ 1065 喵星人吃土豆
- NPOJ 1063 火柴棒拼数
- NPOJ 1086 奇怪包包
- NPOJ 1069 小学生作业
- NPOJ 1064 原原的密信
- 1067
- 1067
- 1067
- 1067
- ZOJ 1067
- ZJU-1067
- poj 1067
- 1067 最小公倍数
- zoj 1067
- 1067 MYSQL
- 在一个非套接字上尝试了一个操作 解决方法
- Mac OS X 10.9 启用 Web 服务器
- 一个Form表单处理提交多个submit按钮
- GDB常用命令
- js实现回放拖拽轨迹从过程上进行分析
- NPOJ 1067 Flappy48
- Ubuntu Linux系统使用命令行修改时区
- 习题3-9 子序列 UVa10340
- Swift学习——Swift基础详解(二)
- 安装Python module
- Nginx HTTP Post Method: 405 Method not allowed 解决办法
- 枚举实现的单例模式
- Javascript字符串对象的常用方法简明版
- java操作文件,不再为编码格式发愁