码迷,mamicode.com
首页 > 其他好文 > 详细

Codeforces Round #640 (Div. 4)

时间:2020-05-14 01:37:16      阅读:50      评论:0      收藏:0      [点我收藏+]

标签:++   除了   names   include   space   bit   ORC   int   题目   

题目链接

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\n",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("\n");
	}
	return 0;
}	

Codeforces Round #640 (Div. 4)

标签:++   除了   names   include   space   bit   ORC   int   题目   

原文地址:https://www.cnblogs.com/whisperbb/p/12885824.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!