2 条题解

  • 1
    @ 2025-10-13 21:05:05

    包对AC

    #include<queue>
    #include<math.h>
    #include<stdio.h>
    #include<iostream>
    #include<vector>
    #include<iomanip>
    #include<string.h>
    #include<algorithm>
    #include<cmath>
    #include<cstdio>
    #include<utility>
    #include<cstring>
    #include<stack>
    #include<fstream>
    #include<string>
    using namespace std;
    typedef long long ll;
    const int N = 1e5 + 10;
    const int INF = 0x3f3f3f3f;
    string s;
    long long c , x , ans = 0 , p = 1;
    int main()
    {
    	cin>>s;
    	c = s.size() - 1;
    	for ( int i = c ; i >= 0 ; i-- )
    	{
    		if ( s[i] >= '0' && s[i] <= '9' )
    		{
    			x = s[i] - '0';
    		}
    		else if ( s[i] >= 'A' && s[i] <= 'Z' )
    		{
    			x = s[i] - 'A' + 10;
    		}
    		else 
    		{
    			x = s[i] - 'a' + 10;
    		}
    		ans += x * p;
    		p *= 16;
    	}
    	cout << ans;
    	return 0;
    }
    
    • -1
      @ 2024-2-16 17:40:13

      #include #include<bits/stdc++.h> #include <math.h> #include <stdio.h> #include #include <string.h> #include #include<bits/stdc++.h> #include #include #include #include #include #include #include #include <math.h> #include <stdio.h> #include #include <string.h> #include using namespace std; string s; int main(){ cin>>s; long c=s.size()-1,ans=0,p=1; { for(int i=c;i>=0;i--) {

      int x;
      	if(s[i]>='0'&&s[i]<='9')x=s[i]-'0';
      	else if(s[i]>='A'&&s[i]<='Z')x=s[i]-'A'+10;
      	else x=s[i]-'a'+10;
      	ans+=x*p;
      	p*=16;
      }	}
      

      cout<<ans; return 0; }

      • 1

      信息

      ID
      1214
      时间
      1000ms
      内存
      128MiB
      难度
      6
      标签
      (无)
      递交数
      72
      已通过
      22
      上传者