为什么最后一个样例没过

P2415 集合求和

代码为什么会这样,明明排了板的
by CXbugs1220 @ 2023-07-14 11:25:43


```c #include<bits/stdc++.h> using namespace std; long long c[110]={0},b[110]={0}; void f(long long n) { int g=0,p=0; memset(b,0,sizeof(b)); while(n>0) { b[p++]=n%10; n/=10; } for(int i=109,j=0;i>=0;i--,j++) { c[i]=c[i]+b[j]+g; g=c[i]/10; c[i]=c[i]%10; } } int main() { long long a[35]={0},k=0,b,l=0,n; while(cin>>b) a[k++]=b; for(int i=0;i<k;i++) { n=a[i]*pow(2,k-1); f(n); } for(int i=0;i<110;i++) if(c[i]!=0) { l=i; break; } for(int i=l;i<110;i++) { cout<<c[i]; } return 0; } ```
by CXbugs1220 @ 2023-07-14 11:26:27


|