数据范围有误!

P1062 [NOIP2006 普及组] 数列

对 我也是第九个点没过
by Cloudesu @ 2017-02-13 13:41:15


对 我也是第九个点没过
by Joyee—Jin @ 2017-04-08 15:16:36


```cpp #include<cstdio> #include<iostream> #include<iomanip> #include<cmath> #include<string> #include<cctype> #include<algorithm> #include<vector> #include<map> #include<set> #include<stack> #include<cstring> #include<queue> #include<ctime> #include<cstdlib> using namespace std; int wow(int a,int b){ if(a==0){ return 1; } if(a==1){ return b; } int s=1; for(int i=1;i<=a;i++){ s*=b; } return s; } int main(){ int k,n; cin>>k>>n; int a=0,b[500]={0},s=0; long long sum=0; while(n!=0){ a++; b[a]=n%2; n/=2; } for(int i=1;i<=a;i++){ if(s!=0){ sum+=b[i]*wow(s,k); } s++; } cout<<sum; return 0; } ``` /\* \*/
by cwnuaa @ 2017-04-11 20:58:27


第四个点错,第九个点对
by cwnuaa @ 2017-04-11 20:59:16


```cpp #include<iostream> #include<cstdio> using namespace std; long long exp(int a,int b) { long long s=1; for(int i=1;i<=b;i++)s*=a; return s; } int main() { int x,m,count=0; cin>>x>>m; long long n=0; while(m>0) { if(m%2==1)n+=exp(x,count); m/=2; count++; } if(n==0)cout<<1<<endl; else cout<<n<<endl; return 0; } ```
by 装那啥遭雷劈 @ 2017-10-07 12:45:57


谢谢
by HuangBo @ 2018-02-02 09:26:24


|