help?!
2024-06-21 20:51:36
发布于:广东
12阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
int len=s.size(),b=0,k=1;
//cout<<b<<"\n";
for(int i=len-1;i>=0;i--){
if(i==0 and s[i]=='0')
{
continue;
}
int g=s[i]-'0';
//cout<<g<<" ";
b=b+g*k;
//cout<<b<<" ";
k=k*10;
//cout<<"\n";
}
//cout<<b<<endl;
int a=b-1234567+1;
cout<<a;
}
这里空空如也
有帮助,赞一个