标签:style blog io color os for sp div on
1 #include<cstdio> 2 #include<iostream> 3 #include<string> 4 using namespace std; 5 string s; 6 int n,pow2[32]; 7 long long ans; 8 void init() 9 { 10 pow2[0]=1; 11 for(int i=1;i<=31;i++) pow2[i]=(pow2[i-1]<<1); 12 } 13 int main() 14 { 15 scanf("%d",&n); init(); 16 for(int i=1;i<=n;i++) 17 { 18 cin>>s; 19 int len=s.length(),res=0; 20 for(int i=len-1,j=0;i>=0;i--,j++) res+=pow2[j]*(s[i]-‘0‘); 21 ans+=(long long)res; 22 } 23 printf("%lld\n",ans); 24 return 0; 25 }
标签:style blog io color os for sp div on
原文地址:http://www.cnblogs.com/autsky-jadek/p/4056358.html