跳到正文

题解

B3884 [信息与未来 2015] 加数 题解

zhangdihong约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 1 分钟
获赞
1
题目
B3884

版本

  1. v1当前

这题先初始化再模拟n/2的过程就行了。 直接上代码。

C++
#include<bits/stdc++.h>
using namespace std;
int n;
string s;
int main(){
	cin>>n;
	for(int i=n;i>0;i=i/10)
		s+=char((n%10)+'0');
	while(n>0)
	{
		n=n/2;
		for(int i=n;i>0;i=i/10)
			s+=char((n%10)+'0');
	}
	cout<<s.size();
	return 0;
}
原文