6503 简写还原
经验值:1200 时间限制:1000毫秒
题目描述 Description
酷酷今天跑了100000003厘米,类似于这样的数中有很多个0,为了看起来更直接,人们经常会将其简写为108+3.
现在给出这种简写格式的数10a+b,请你将它还原。
输入描述 Input Description
一行,两个整数a,b
输出描述 Output Description
一个整数
样例输入 Sample Input
8 3
样例输出 Sample Output
100000003
数据范围及提示 Data Size & Hint
0≤a≤500
0≤b<1018
WA 0分代码:
#include<iostream>
using namespace std;
long long int sum=10;
int cnt1,cnt;
int main(){
int a;
long long int b;
cin>>a>>b;
long long int w=b;
for(int i=1;i<a;i++){
sum*=10;
}
while(sum){
cnt++;
sum/=10;
}
while(w){
cnt1++;
w/=10;
}
if(cnt1==cnt){
cout<<b;
return 0;
}
cout<<1;
for(int i=1;i<=cnt-cnt1-1;i++){
cout<<0;
}
cout<<b;
return 0;
}
这题我没用string,结果我就很快乐地WA了
丁博扬在2021-06-06 07:04:45追加了内容
顶
丁博扬在2021-06-06 07:05:04追加了内容
顶
丁博扬在2021-06-07 16:02:33追加了内容
顶
丁博扬在2021-06-07 20:15:15追加了内容
顶
丁博扬在2021-06-13 06:40:39追加了内容
以自行解决,先输入“148526”的我采纳
