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 ...
随机推荐
- BZOJ 3130 二分+网络流
思路: 不被题目忽悠就是思路 二分一下max 判一下等不等于最大流 搞定 7 9 1 1 2 3 1 3 3 2 3 3 3 4 2 3 5 2 3 6 1 4 7 2 5 7 2 6 7 2 这里有 ...
- 【DotNetNuke介绍】
简介 DotNetNuke(以下简称DNN)的最终目的是创建一个门户的框架平台,这个平台可以为开发者增添模块搭建应用程序提供坚实的可靠的支持.应用程序的一个关键的功能就是数据存取..NET Frame ...
- PostgreSQL两种事务隔离级
PostgreSQL两种事务隔离级别: 读已提交:PostgreSQL中缺省隔离级别.当一个事务运行在这个隔离级别时,一个SELECT查询只能看到查询开始之前提交的数据而永远无法看到未提交的数据或者在 ...
- asp.net网页播放MP4 出错
通过IIS进行添加:单击[开始]→[程序]→[管理工具]→[IIS管 理器],逐步展开“本地计算机”.“网站”,在你的网站上右击,选择[属性],单击“HTTP头”选项卡→单击“MIME类型”按钮,再单 ...
- SQL流程控制语句
1 GoTo语句 IF 12>9GOTO print1ELSE GOTO print2 print1:PRINT '执行了流程1'--GOTO theEndprint2:PRINT '执行了流程 ...
- Chromium Graphics: Graphics and Skia
Graphics and Skia Chrome uses Skia for nearly all graphics operations, including text rendering. GDI ...
- P3514 [POI2011]LIZ-Lollipop(规律+瞎搞)
题意 给一个只有1和2的序列,每次询问有没有一个子串的和为x ( 1≤n,m≤1 000 000 )kkk ( 1≤k≤2 000 000 ) 题解 我觉得是道好题. 主要是证明一个性质:假如有一个字 ...
- [洛谷P1939]【模板】矩阵加速(数列)
题目大意:给你一个数列a,规定$a[1]=a[2]=a[3]=1$,$a[i]=a[i-1]+a[i-3](i>3)$求$a[n]\ mod\ 10^9+7$的值. 解题思路:这题看似是很简单的 ...
- shell清除日志小脚本
#!/bin/bash #清除日志脚本 LOG_DIR=/var/log ROOT_UID=0 #用户id为0的 ,即为root if [ "$UID" -ne "$RO ...
- CMDB学习之六 --客户端请求测试,服务端api优化
客户端使用agent 请求测试,agent使用的POST 请求,使用requests模块 本地采集,汇报服务端 #!/usr/bin/env python # -*- coding:utf-8 -*- ...