3 条题解

  • 0
    @ 2025-1-29 18:58:09
    #include<bits/stdc++.h>
    using namespace std;
    const int N=1e2+5,INF=0x3f3f3f3f;
    int b,a,cnt,ans,s;
    int main()
    {
    	cin>>b>>a;
    	while(a!=0){
    		s = a%10;
    		a/=10;
    		ans+=pow(b,cnt++)*s;
    	}
    	cout<<ans;
    	return 0;
    }
    
    • -1
      @ 2024-10-20 13:43:44

      #include<bits/stdc++.h> using namespace std; int main(){ int b,a,s=0,i; string n;[ ]

      229/65536

      #include<bits/stdc++.h>
      using namespace std;
      int main(){
      int b,a,s=0,i;
      string n;
      cin>>b>>n;
      a=n.size();
      for(i=0;i<a;i++){
      if(n[i]>='0'&&n[i]<='9')s+=(n[i]-48)*pow(b,a-i-1);
      else s+=(n[i]-87)*pow(b,a-i-1);
      }
      cout<<s;
      return 0;
      }

      #include<bits/stdc++.h> using namespace std; int main(){ int b,a,s=0,i; string n; cin>>b>>n; a=n.size(); for(i=0;i<a;i++){ if(n[i]>='0'&&n[i]<='9')s+=(n[i]-48)*pow(b,a-i-1); else s+=(n[i]-87)*pow(b,a-i-1); } cout<<s; return 0; } cin>>b>>n; a=n.size(); for(i=0;i<a;i++){ if(n[i]>='0'&&n[i]<='9')s+=(n[i]-48)*pow(b,a-i-1); else s+=(n[i]-87)*pow(b,a-i-1); } cout<<s; return 0; }

      • -1
        @ 2024-10-20 13:17:51
        #include<bits/stdc++.h>
        using namespace std;
        const int N=1e5+10;
        int main(){
        	int n,b,sum=0,i=0;
        	int a[N];
        	cin>>b>>n;
        	while(n){
        		sum+=n%10*pow(b,i);
        		n/=10;
        		i++;
        	}
        	cout<<sum;
        }
        
        • 1

        信息

        ID
        1218
        时间
        1000ms
        内存
        128MiB
        难度
        7
        标签
        递交数
        336
        已通过
        87
        上传者