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 ...
随机推荐
- 如何在github的README.md中添加图片
如何在github的README.md中添加图片 总结: 链接引用: 简介: 1.在github上的仓库建立一个存放图片的文件夹,文件夹名字随意.如:img ...
- python中对单例模式的理解
class Foo(object): instance = None def __init__(self): pass def process(self): ' @classmethod #版本1单例 ...
- [Atcoder Grand 006 C] Rabbit Exercise 解题报告 (期望)
题目链接:https://www.luogu.org/problemnew/show/AT2164 https://agc006.contest.atcoder.jp/tasks/agc006_c 题 ...
- Dictionary subtraction
Finding the words from the book that are not in the word list from words.txt is a problem you might ...
- css inline-block列表布局
一.使用inline-block布局 二.多列布局方法二 <html><head> <meta charset="utf-8"> <tit ...
- 说说Kindle那些事
已经不记得是什么时候在哪里听过kindle这玩意的了,反正最开始买kindle还是大四上学期,貌似是2012-9-30,那时候是整个大学最闲的时候,不知道哪天闲的蛋疼一冲动就买了个kindle4黑色款 ...
- APUE 学习笔记 —— 文件I/O
本章节主要讲了 Linux 系统下的关于文件I/O操作的几个函数:open.read.write.lseek.close 的使用和需要注意的一些细节.接着,又介绍了多进程见如何共享文件.下面开始知识点 ...
- [NOI2015]品酒大会(SA数组)
[NOI2015]品酒大会 题目描述 一年一度的"幻影阁夏日品酒大会"隆重开幕了.大会包含品尝和趣味挑战 两个环节,分别向优胜者颁发"首席品酒家"和" ...
- 【Educational Codeforces Round 37 A】 Water The Garden
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 记录下水龙头在哪些位置. 然后每秒钟把index-i和index+i改变状态一下就好(置1 [代码] #include <bi ...
- ECNUOJ 2616 游黄山
游黄山 Time Limit:1000MS Memory Limit:65536KB Total Submit:165 Accepted:52 Special Judge Description Po ...