zoj1712

来源:互联网 发布:jav番号软件 编辑:程序博客网 时间:2024/05/21 06:57

现在做简单题已经基本可以对准思路了,接下来就应该着重研究acm的各种算法了,真正的困难来了,做好好几天都做不出来一道题的准备吧。

#include<stdio.h>#include<string.h>#include<math.h>#include<stdlib.h>char sk[40];long sum;int main(){  int n;  int i;  int count=2;  scanf("%s",sk);  while(sk[0]!='0')  {    sum=0;    n=strlen(sk);    for(i=n-1;i>=0;i--)    {      sum=sum+(sk[i]-'0')*(count-1);      count=count<<1;    }    count=2;    printf("%d\n",sum);    scanf("%s",sk);  }   return 0;}


 

原创粉丝点击