Section2.2

摘要: #include<stdio.h>int main(){ int a,b,c; while(scanf("%X%X",&a,&b)!=EOF) { c=a+b; printf("%d\n",c); }} 阅读全文
posted @ 2011-09-30 23:05 csushin 阅读(62) 评论(0) 推荐(0)

Section2.1

摘要: #include<stdio.h>int main(){ int N,a,b=0,s=0,i; while(scanf("%d",&N)==1) { if(N==0) break; for(i=0;i<N;i++) { scanf("%d",&a); if(a>b) s=6*(a-b)+5+s; else s=s+4*(b-a)+5; b=a; } printf("%d\n",s); a=0;s=0;N=0;b=0; }} 阅读全文
posted @ 2011-09-30 23:01 csushin 阅读(68) 评论(0) 推荐(0)