武汉科技大学ACM :1003: 零起点学算法14——三位数反转
Problem Description
水题
Input
输入1个3位数(题目包含多组测试数据)
Output
分离该3位数的百位、十位和个位,反转后输出(每组测试数据一行)
Sample Input
250
Sample Output
052
HINT
分离出各位数字可以用取余和除数
注意在C语言里,2个整数相乘除结果还是整数 比如8/3在C语言里结果是2
取余采用符号%
比如8%3的结果应该是2即8除以3后的余数
#include <stdio.h> int main() { int splitInt,one,ten,hundred; while(scanf("%d",&splitInt)!=EOF) { hundred = splitInt/; ten = splitInt%/; one = splitInt%; printf("%d%d%d\n",one,ten,hundred); } return ; }
其他代码:
#include<stdio.h>
int main()
{
int n,m;
while(scanf("%d",&n)!=EOF)
{
while(n>)
{
m=n%;
n/=;
printf("%d",m);
}
printf("\n");
}
return ;
}
武汉科技大学ACM :1003: 零起点学算法14——三位数反转的更多相关文章
- Problem S: 零起点学算法14——三位数反转
#include<stdio.h> #include<stdlib.h> int main() { int a,b,c,s; scanf("%d",& ...
- WUOJ-ACM :1003: 零起点学算法78——牛牛
武汉科技大学ACM :1003: 零起点学算法78--牛牛Problem Description牛牛是一种纸牌游戏,总共5张牌,规则如下: 如果找不到3张牌的点数之和是10的倍数,则为没牛: 如果其中 ...
- 武汉科技大学ACM :1003: 零起点学算法78——牛牛
Problem Description 牛牛是一种纸牌游戏,总共5张牌,规则如下: 如果找不到3张牌的点数之和是10的倍数,则为没牛: 如果其中3张牌的点数之和是10的倍数,则为有牛,剩下两张牌的点数 ...
- 武汉科技大学ACM :1003: 零起点学算法67——统计字母数字等个数
Problem Description 输入一串字符,统计这串字符里的字母个数,数字个数,空格字数以及其他字符(最多不超过100个字符) Input 多组测试数据,每行一组 Output 每组输出一行 ...
- 1163: 零起点学算法70——Yes,I can!
1163: 零起点学算法70--Yes,I can! Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted: ...
- 1164: 零起点学算法71——C语言合法标识符(存在问题)
1164: 零起点学算法71——C语言合法标识符 Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted: 10 ...
- 1147: 零起点学算法54——Fibonacc
1147: 零起点学算法54--Fibonacc Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted: 20 ...
- 1145: 零起点学算法52——数组中删数II
1145: 零起点学算法52--数组中删数II Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted: 293 ...
- 1137: 零起点学算法44——多组测试数据输出II
1137: 零起点学算法44--多组测试数据输出II Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted: ...
随机推荐
- Forms & HTML 组件 - laravelcollective/html
简书链接 :Forms & HTML 组件 - laravelcollective/html 安装 方法一: composer require laravelcollective/html 方 ...
- 代码度量工具——SourceMonitor的学习和使用
http://www.cnblogs.com/bangerlee/archive/2011/09/18/2178172.html 引言 我们提倡编写功能单一.结构清晰.接口简单的函数,因为过于复杂的函 ...
- 温故而知新 C++ 类型转换
C语言类型转换 在C语言里用到的类型转换方式,一般都是用强制类型转换,语法:(类型说明符)(表达式),例如: (float)a 把a转换为实型,(int)(x+y) 把x+y的结果转换为整型.C语言这 ...
- RUBY类特性
学习教材 class Person def initialize(name,age=18) @name=name @age=age @motherland="China" end ...
- org.quartz.utils.UpdateChecker Checking for available updated version of Quartz..
<dependency> <groupId>org.quartz-scheduler</groupId> <artifactId>quartz</ ...
- Java ClassLoader基础及加载不同依赖 Jar 中的公共类(转)
http://www.iteye.com/topic/1135259 http://www.trinea.cn/android/java-loader-common-class/ http://www ...
- jquery $.each() 小探
<html> <head> <title> jquery each使用 </title> <script type='text/javascrip ...
- 【HDOJ】5017 Ellipsoid
简单地模拟退火. /* 5017 */ #include <cstdio> #include <cstring> #include <cstdlib> #inclu ...
- 查找最小的K个元素,使用最大堆。
查找最小的K个元素,使用最大堆,具体代码如下: #define _CRT_SECURE_NO_WARNINGS #include <iostream> using namespace st ...
- Flask+Mysql搭建网站之网页设计
不得不说,本人极度讨厌网页设计,感觉太麻烦了.不过整好啦还蛮有成就感的. 关于网页设计,现在流行的是扁平化设计. http://www.bootcss.com/ http://www.bootcss. ...