Codeforces Round #640 (Div. 4)

题目链接

A

大意

将一个除了首位,其余为都为0的数成为round,先给一个数n,求出可以拆分成多少个round

代码

#include<bits/stdc++.h>
using namespace std;
int main(){
	int t = 0;
	int n = 0;
	cin>>t;

	for(int i = 0; i < t; i++){
		scanf("%d", &n);
		int num = 0;
		int ans = 0;
		string str = to_string(n);
		int len = str.size();
		for(int i = 0; i < len; i++){
			if(str[i] != '0') num++;
		}
		printf("%d
",num);
		for(int i = 0; i < len; i++){
			if(str[i] != '0'){
				ans = (str[i] - '0') * pow(10,len - i - 1);
				printf("%d ",ans);
		}
		
	}
	printf("
");
	}
	return 0;
}	
原文地址:https://www.cnblogs.com/whisperbb/p/12885824.html