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 ...
随机推荐
- array_unique和array_flip 这两个函数的区别
array_unique和array_flip 这两个函数的区别 标签(空格分隔): php array_unique 和 array_flip 验证 1 没有排序的数组 2 array_unique ...
- directshow 获取本地摄像头播放
最近因为项目的需要,做了一个基本的获取本地笔记本摄像头并且播放的例子,因为网上的关于这部分的完整例子基本都没有,那我就上传一个吧,希望能够帮到需要学习视频的朋友. 另外也是为了纪念雷霄骅博士为音视频方 ...
- JavaScript总结(3)
第3章 获取用户的输入 <script>10 intA=prompt("请输入第一个数字","");11 intB=prompt("请输入 ...
- LeetCode(6)ZigZag Conversion
题目如下: C++代码: #include <iostream> #include <string> using namespace std; class Solution { ...
- session 存入 redis
<?php header('content-type:text/html;charset=utf-8'); /* * 更改 session 存储位置及存储方式. */ ini_set('sess ...
- Linux学习,部署django项目到服务器,及安装python,uwsgi等
开启网络 vi /etc/sysconfig/network-script/ifcfg-eth0 onboot=yes 退出保存 service network restart ping www.ba ...
- 紫书 习题 10-8 UVa 10622(gcd)
把这个数质因数分解然后求因子个数的gcd就ok了. 一些细节 (1)这道题的质因数不需要存下来,每一次做完取一次gcd就ok了 (2)判断奇偶用ans & 1的时候要加括号, 位运算要注意括号 ...
- CF17E Palisection(回文树)
题意翻译 给定一个长度为n的小写字母串.问你有多少对相交的回文子 串(包含也算相交) . 输入格式 第一行是字符串长度n(1<=n<=2*10^6),第二行字符串 输出格式 相交的回文子串 ...
- 【Henu ACM Round#16 E】Paths and Trees
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 感觉很像一道最短路. 然后就试了一发. 结果真的是.. 只要用一个优先队列优化的dijkstra算法求出每个点的最短路上的前一个点是 ...
- CodeForces 383C Propagating tree
Propagating tree Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForces ...