UVa 10101 - Bangla Numbers
题目:将数字数转化成数字加单词的表示形式输出。
分析:数论。简单题。直接分成两部分除10000000的商和余数,分别输出就可以。
说明:注意输入为数字0的情况,还有long long类型防止溢出。
#include <iostream>
#include <cstdlib>
#include <cstdio> using namespace std; void output(long long a)
{
if (a >= 10000000LL) {
output(a/10000000LL);
printf(" kuti");
output(a%10000000LL);
}else {
if (a >= 100000LL)
cout << " " << (a/100000LL) << " lakh";
a %= 100000LL;
if (a >= 1000LL)
cout << " " << (a/1000LL) << " hajar";
a %= 1000LL;
if (a >= 100LL)
cout << " " << (a/100LL) << " shata";
a %= 100LL;
if (a > 0LL)
cout << " " << a;
}
} int main()
{
int t = 1;
long long n;
while (cin >> n) {
printf("%4d.",t ++);
output(n);
if (n == 0LL)
printf(" 0");
printf("\n");
}
return 0;
}
UVa 10101 - Bangla Numbers的更多相关文章
- UVa 10006 - Carmichael Numbers
		UVa 10006 - Carmichael Numbers An important topic nowadays in computer science is cryptography. Some ... 
- Uva - 12050 Palindrome Numbers【数论】
		题目链接:uva 12050 - Palindrome Numbers 题意:求第n个回文串 思路:首先可以知道的是长度为k的回文串个数有9*10^(k-1),那么依次计算,得出n是长度为多少的串,然 ... 
- UVA.136 Ugly Numbers (优先队列)
		UVA.136 Ugly Numbers (优先队列) 题意分析 如果一个数字是2,3,5的倍数,那么他就叫做丑数,规定1也是丑数,现在求解第1500个丑数是多少. 既然某数字2,3,5倍均是丑数,且 ... 
- UVA - 13022 Sheldon Numbers(位运算)
		UVA - 13022 Sheldon Numbers 二进制形式满足ABA,ABAB数的个数(A为一定长度的1,B为一定长度的0). 其实就是寻找在二进制中满足所有的1串具有相同的长度,所有的0串也 ... 
- UVA - 136   Ugly Numbers (有关set使用的一道题)
		Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence1, 2, 3, 4, 5, 6, 8, 9, ... 
- POJ2402/UVA 12050 Palindrome Numbers 数学思维
		A palindrome is a word, number, or phrase that reads the same forwards as backwards. For example,the ... 
- UVA 10006 - Carmichael Numbers 数论(快速幂取模 + 筛法求素数)
		Carmichael Numbers An important topic nowadays in computer science is cryptography. Some people e ... 
- UVa 11461 - Square Numbers【数学,暴力】
		题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem ... 
- UVA 350 Pseudo-Random Numbers
		Pseudo-Random Numbers Computers normally cannot generate really random numbers, but frequently are ... 
随机推荐
- HDOJ 4975 A simple Gaussian elimination problem.
			和HDOJ4888是一样的问题,最大流推断多解 1.把ISAP卡的根本出不来结果,仅仅能把全为0或者全为满流的给特判掉...... 2.在残量网络中找大于2的圈要用一种类似tarjian的方法从汇点開 ... 
- CentOS6.8下完全干净卸载mysql
			来源整理于 https://www.cnblogs.com/wanghuaijun/p/6398240.html 虚拟机CentOS6.8下 先执行命令查看目录是否存在mysql 文件夹: cd ... 
- bootstrap-treeview简单使用
			废话不多说,直接上干干货. 1.bootstrap-treeview Github网址:https://github.com/jonmiles/bootstrap-treeview 2.使用要求: & ... 
- CSS W3SCHOOLS
			https://www.w3schools.com/csS/css3_buttons.asp 
- 单调队列&单调栈归纳
			单调队列 求长度为M的区间内的最大(小)值 单调队列的基本操作,也就是经典的滑动窗口问题. 求长度为M的区间内最大值和最小值的最大差值 两个单调队列,求出长度为M的区间最大最小值的数组,分别求最大最小 ... 
- [JLOI2011]飞行路线(分层图)
			[JLOI2011]飞行路线 题目描述 Alice和Bob现在要乘飞机旅行,他们选择了一家相对便宜的航空公司.该航空公司一共在 n 个城市设有业务,设这些城市分别标记为 0 到 n−1 ,一共有 m ... 
- iOS日期转换之UTC/GMT时间格式
			GMT只需要将代码中的UTC替换为GMT即可 //将本地日期字符串转为UTC日期字符串 //本地日期格式:2013-08-03 12:53:51 //可自行指定输入输出格式 -(NSString *) ... 
- gpdb删除segment上残余的session和sql
			转载请注明出处:gpdb删除segment上残余的session和sql 最近公司的gpdb的变卡,导致线上系统查询队列阻塞,用户一点数据都查不出来. 每天早上我和同事都得用我们自家做的gpdb运维平 ... 
- spring AOP的Pointcut注解报错
			error at ::0 can't find referenced pointcut spring使用的是4.1.0,在项目中直接复制旧的aspectjweave.jar报错了 然后换成aspect ... 
- iOS数字媒体开发浅析
			概述 自然界中的所有看到的听到的都是模拟信号,模拟信号是随时间连续变化,然而手机电脑等信息都属于数字媒体,它们所呈现的内容就是把自然界中这些模拟信号转换成数字信号然后再传递给我们.数字信号不是连续的是 ... 
