当前位置:网站首页>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;
}边栏推荐
- Gee series: Unit 5 remote sensing image preprocessing [GEE grid preprocessing]
- Gee series: unit 9 generate sampling data in GEE [random sampling]
- Youth training camp -- database operation project
- Database batch insert data
- 青训营--数据库实操项目
- Global and Chinese market of pressure gauges 2022-2028: Research Report on technology, participants, trends, market size and share
- 7.1 Résumé du concours de simulation
- KMP idea and template code
- Fabric. JS basic brush
- Fabric. JS iText superscript and subscript
猜你喜欢

Collectors.groupingBy 排序
![Gee series: unit 9 generate sampling data in GEE [random sampling]](/img/ff/edb27b40f63eca81c5683e81b2860b.jpg)
Gee series: unit 9 generate sampling data in GEE [random sampling]

Fabric. JS right click menu

paddle: ValueError:quality setting only supported for ‘jpeg‘ compression

函数栈帧的创建和销毁

Visual Studio导入

Fabric. JS upload local image to canvas background

青训营--数据库实操项目
![Gee: use of common mask functions in remote sensing image processing [updatemask]](/img/55/bf4ef5fc923242e72caab71f1a4e4b.jpg)
Gee: use of common mask functions in remote sensing image processing [updatemask]

Fabric. JS gradient
随机推荐
Online English teaching app open source platform (customized)
【pyinstaller】_ get_ sysconfigdata_ name() missing 1 required positional argument: ‘check_ exists‘
How matlab marks' a 'in the figure and how matlab marks points and solid points in the figure
Briefly introduce chown command
No logic is executed after the El form is validated successfully
LeetCode 241. Design priorities for operational expressions (divide and conquer / mnemonic recursion / dynamic programming)
Gee: remote sensing image composite and mosaic
Fabric. JS iText superscript and subscript
Gee: explore the characteristics of precipitation change in the Yellow River Basin in the past 10 years [pixel by pixel analysis]
JVM class loading mechanism
7.1 Résumé du concours de simulation
Principle and implementation of parallax effect
Gee series: Unit 4 data import and export in Google Earth engine
ThreadLocal memory leak
Detailed explanation of Pointer use
Fabric.js 自由绘制矩形
运维工作的“本手、妙手、俗手”
7. Eleven state sets of TCP
LeetCode 1175. Prime number arrangement (prime number judgment + Combinatorial Mathematics)
460. LFU cache bidirectional linked list