Alberta licence plates currently have a format of ABC-0123 (three letters followed by four digits).

    We say that the licence plate is “nice” if the absolute difference between the value of the first part and the value of the second part is at most 100.
    The value of the first part is calculated as the value of base-26 number (where digits are in [A…Z]). For instance, if the first part is “ABC”, its value is 28 (0∗262+1∗261+2∗260). So, the plate “ABC-0123” is nice, because |28 − 123| ≤ 100.
    Given the list of licence plate numbers, your program should determine if the plate is nice or not.
Input
First line of the input contains an integer N (1 ≤ N ≤ 100), the number of licence plate numbers. Then follow N lines, each containing a licence plate in the format ‘LLL-DDDD’.
Output
For each licence plate print on a line ‘nice’ or ‘not nice’ (without quotes) depending on the plate number being nice as described in the probem statement.
Sample Input
2
ABC-0123
AAA-9999
Sample Output
nice
not nice

问题链接:UVA12602 Nice Licence Plates
问题简述:(略)
问题分析
    简单的进制题,不解释。
程序说明:(略)
参考链接:(略)
题记:(略)

AC的C++语言程序如下:

/* UVA12602 Nice Licence Plates */#include <bits/stdc++.h>using namespace std;const int AN = 26;
const int B = 10;
const int L = 10;
char s[L];int main()
{int n;scanf("%d", &n);while(n--) {scanf("%s", s);int l = ((s[0] - 'A') * AN + (s[1] - 'A')) * AN + s[2] - 'A';int r = (((s[4]-'0')*B + s[5]-'0')*B + s[6]-'0')*B + s[7] - '0';int d = l - r;printf(-100 <= d && d <= 100 ? "nice\n" : "not nice\n");}return 0;
}

UVA12602 Nice Licence Plates【进制】相关推荐

  1. java 16进制与图片互转

    十六进制转成图片 /*** 十六进制转成图片* @author Administrator**/public static void saveToImgFile(String src,String o ...

  2. LeetCode简单题之K 进制表示下的各位数字总和

    题目 给你一个整数 n(10 进制)和一个基数 k ,请你将 n 从 10 进制表示转换为 k 进制表示,计算并返回转换后各位数字的 总和 . 转换后,各位数字应当视作是 10 进制数字,且它们的总和 ...

  3. LeetCode简单题之七进制数

    题目 给定一个整数 num,将其转化为 7 进制,并以字符串形式输出. 示例 1: 输入: num = 100 输出: "202" 示例 2: 输入: num = -7 输出: & ...

  4. Java IDEA Debug进制二维数组

    1.Debug模式 1.1 什么是Debug模式 是供程序员使用的程序调试工具,它可以用于查看程序的执行流程,也可以用于追踪程序执行过程来调试程序. 1.2 Debug介绍与操作流程 如何加断点 选择 ...

  5. python 16进制转10进制, 8进制转10进制, 2进制转10进制的方法

    python 16进制转10 进制, 8进制转10进制, 2进制转10进制 可以使用系统自带的 int 方法 具体如下: value = "0x1388" result = int ...

  6. Java中byte与16进制字符串的互相转换

    https://www.cnblogs.com/qinwangchen/p/5418028.html * Convert byte[] to hex string.这里我们可以将byte转换成int, ...

  7. 【Luogu】P1013进制位(搜索)

    题目链接在这里 这题和虫食算比较类似.做完这道题可以去做虫食算.都是搜索一类的题. 这样 我们分析题目可以发现进制只可能是字母的个数,也就是n-1.为什么? 因为题目要求完整的加法表才算数.如果进制低 ...

  8. -变量,进制,数据类型,标识符

    ###02.01_Java语言基础(常量的概述和使用)(掌握) * A:什么是常量 * 在程序执行的过程中其值不可以发生改变 * B:Java中常量的分类 * 字面值常量 * 自定义常量(面向对象部分 ...

  9. python中不同进制的整数之间可以直接运算_Python 进制转换、位运算

    一.进制转换 编程用十进制,十进制转换为二进制.八进制.十六进制 In [135]: bin(23) Out[135]: '0b10111' In [136]: oct(23) Out[136]: ' ...

最新文章

  1. 2840 页的计算机毕业论文,这位华人小哥的博士论文究竟写了啥?
  2. python读数据-如何用 Python 读取数据?
  3. 雇水军刷分有效吗?虚假评论的影响研究分析
  4. 【机器学习基础知识】各类熵总结
  5. linux openldap mysql_CentOS7安装OpenLDAP+MySQL+PHPLDAPadmin
  6. 生活的花环:看雷加对文学的回顾
  7. c# 类的基本知识,未完,待续
  8. 京东五星电器送扫地机器人_京东五星电器联手打造互联网小家电“孵化器”
  9. 易语言下载别人的源码编译出来用不了_我是如何阅读源码的
  10. securecrt 中文横着显示解决
  11. 信任的机器_您应该信任机器人吗?
  12. 【Mybatis】Mybatis三大组件之StatementHandler
  13. VS2015 密钥(证实有效)
  14. 安卓系统加速_安卓系统用户玩LOL手游用网易UU加速器加速被拦截解决方案
  15. C语言apr_socket,APR分析-高级IO篇
  16. (一)生成器详解——简单生成器
  17. [Oracle- MySQL] Oracle通过dblink连接MySQL
  18. 什么是物联网?这里有你需要了解的一切
  19. android签到日历实现
  20. 阿里云ACP认证 VPC专项练习

热门文章

  1. 如何配置 strongSwan 客户端 -- 节选自 OpenSuSE 中文用户手册
  2. Unity AssetBundle 爬坑手记
  3. [ANE for Android]Java接口部分引用第三方JAR的解决办法
  4. python coroutine_Python coroutine的坑
  5. 根据某一个字段查询但不是主键 sql该怎么写_为什么我使用了索引,查询还是慢?...
  6. java split 实现_PL/SQL实现JAVA中的split()方法的例子
  7. 3dmax 计算机中丢失,3DMax如何找回丢失的3D命令面板或工具栏
  8. bilibili怎么用用户名登录_b站(bilibili)账号只记得用户名忘了密码怎么办?实名认证能找回吗...
  9. 大数据系列1-规划安排
  10. 程序设计中的一些感悟