当前位置:网站首页>Zzuli:1061 sequential output of digits
Zzuli:1061 sequential output of digits
2022-07-02 05:29:00 【Don't explode】
Title Description
Enter a value not greater than 10 Of 9 A positive integer to the power , Start from the high bit, divide it bit by bit and output each digit .
Input
Enter a positive integer n,n yes int Type data
Output
Output the numbers in turn , Each number is followed by a space , Output takes up one line . for example , Input 12345 , Output 1 2 3 4 5
The sample input Copy
12345
Sample output Copy
1 2 3 4 5
Tips
Pay attention to integer operation and avoid using double Functions of type, such as pow().
This problem can first use a cycle to calculate the highest bit weight h, And then a loop , The content of the loop is : Output highest bit (n/h)、 Throw away the top (n = n%h)、 Lower the highest position (h = h/10), Until the right position h by 0.
#include <stdio.h>
int main ()
{ int n,a,h;
scanf("%d",&n);
a=n;
h=1;
while(a>9)
{
a/=10;
h*=10;
}
while(h>0)
{
printf("%d ",n/h);
n%=h;
h/=10;
}
return 0;
}
边栏推荐
猜你喜欢
Pyechart1.19 national air quality exhibition
Gee dataset: chirps pentad high resolution global grid rainfall dataset
Visual Studio导入
【pyinstaller】_ get_ sysconfigdata_ name() missing 1 required positional argument: ‘check_ exists‘
Fabric. JS gradient
JVM class loading mechanism
Innovation never stops -- the innovation process of nvisual network visualization platform for Excel import
7. Eleven state sets of TCP
Fabric. JS iText set italics manually
Fabric.js 右键菜单
随机推荐
Collectors.groupingBy 排序
Fabric. JS right click menu
Nodejs (03) -- custom module
Gee: use of common mask functions in remote sensing image processing [updatemask]
Global and Chinese market of commercial fish tanks 2022-2028: Research Report on technology, participants, trends, market size and share
Gee: find the spatial distribution and corresponding time of the "greenest" in the Yellow River Basin in 2020 [pixel by pixel analysis]
Global and Chinese market of impact roll 2022-2028: Research Report on technology, participants, trends, market size and share
Using Kube bench and Kube hunter to evaluate the risk of kubernetes cluster
Fabric.js 右键菜单
Leetcode 18 problem [sum of four numbers] recursive solution
Importation de studio visuel
idea开发工具常用的插件合集汇总
记录sentry的踩坑之路
Gee: create a new feature and set corresponding attributes
460. LFU 缓存 双向链表
Financial portal related information
Centos8 installation mysql8.0.22 tutorial
Fabric.js IText 手动设置斜体
Visual Studio導入
线程池批量处理数据