noip2013 积木大赛 (贪心)
2015-10-30 15:50
337 查看
代码:
#include<cstdio> #include<cstring> #include<cctype> using namespace std; int getin() { int ans=0;char tmp; while(!isdigit(tmp=getchar())); do ans=(ans<<3)+(ans<<1)+tmp-'0'; while(isdigit(tmp=getchar())); return ans; } int main() { int n=getin(),i,x=0,y,ans=0; for(i=1;i<=n;x=y,i++) if((y=getin())>x)ans+=y-x; printf("%d\n",ans); return 0; }
相关文章推荐
- PHP trim() 函数
- 七牛上传文件 图片
- java 乱码原因分析
- Codeforces Round #327 (Div. 2) E. Three States bfs
- openstack中虚拟机和其网络的联系方法 instance and network
- 使用JavaScript正则表达式如何去掉双引号
- 在使用O_APPEND 标志并以写打开一个已存在的文件,然后用lseek函数将偏移置于开头,在写入数据,写入的数据会显示在那个位置呢???
- I18N
- POJ2247 Humble Numbers
- 52.VC(Custom)-vc助手–支持预生成宏、注释
- 用来显示学生的信息
- erl_tree RBT 红黑树
- angularjs 绑定enter事件的两种方法
- 淘宝基础版全屏table布局代码
- spring mvc和struts2比较
- Android Studio导入jar后无法识别、但项目能正常运行的问题
- 详解java类的生命周期
- 解决linux too many files问题
- java Object类介绍
- L与JSON数据结构解析工程