Description

On the planet Zoop, numbers are represented in base 62, using the digits
0, 1, . . . , 9, A, B, . . . , Z, a, b, . . . , z
where
A (base 62) = 10 (base 10)
B (base 62) = 11 (base 10)
...
z (base 62) = 61 (base 10).
Given the digit representation of a number x in base 62, your goal is to determine if x is divisible by 61.

Input

The
input test file will contain multiple cases. Each test case will be
given by a single string containing only the digits ‘0’ through ‘9’, the
uppercase letters ‘A’ through ‘Z’, and the lowercase letters ’a’
through ’z’. All strings will have a length of between 1 and 10000
characters, inclusive. The end-of-input is denoted by a single line
containing the word “end”, which should not be processed. For example:

1v3
2P6
IsThisDivisible
end

Output

For each test case, print “yes” if the number is divisible by 61, and “no” otherwise. For example:
yes
no
no
In the first example, 1v3 = 1 × 622 + 57 × 62 + 3 = 7381, which is divisible by 61.
In the second example, 2P6 = 2 × 622 + 25 × 62 + 6 = 9244, which is not divisible by 61.

Sample Input

1v3
2P6
IsThisDivisible
end

Sample Output

yes
no
no

Source

SLPC 2007

62进制的数是否能被61整除。

输入的数达10000位,但是可以一边运算一边mod。

#include <stdio.h>
#include <string.h> int convertToInt(char a){
if(''<=a && a<='')return a-'';
if('A'<=a && a<='Z')return a-'A'+;
if('a'<=a && a<='z')return a-'a'+;
} int main()
{
char ch[];
while( scanf("%s",ch), strcmp("end",ch)!= ){
int mo=;
int temp=;
for(int i=; ch[i]!='\0'; i++,temp*=){
mo+=convertToInt(ch[i])*temp;
mo%=;
temp%=;
}
if(mo==){
puts("yes");
}else{
puts("no");
}
}
return ;
}

TOJ 3486 Divisibility的更多相关文章

  1. TOJ 2776 CD Making

    TOJ 2776题目链接http://acm.tju.edu.cn/toj/showp2776.html 这题其实就是考虑的周全性...  贡献了好几次WA, 后来想了半天才知道哪里有遗漏.最大的问题 ...

  2. cf306 C. Divisibility by Eight(数学推导)

    C. Divisibility by Eight time limit per test 2 seconds memory limit per test 256 megabytes input sta ...

  3. 周赛-Clique in the Divisibility Graph 分类: 比赛 2015-08-02 09:02 23人阅读 评论(3) 收藏

    Clique in the Divisibility Graph time limit per test1 second memory limit per test256 megabytes inpu ...

  4. Codeforces Round #306 (Div. 2) C. Divisibility by Eight 暴力

    C. Divisibility by Eight Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/ ...

  5. Divisibility by Eight (数学)

    Divisibility by Eight time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  6. codeforces 630J Divisibility

    J. Divisibility time limit per test 0.5 seconds memory limit per test 64 megabytes input standard in ...

  7. Codeforces Testing Round #12 A. Divisibility 水题

    A. Divisibility Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/597/probl ...

  8. Divisibility

    Description Consider an arbitrary sequence of integers. One can place + or - operators between integ ...

  9. HDU 3335 Divisibility (DLX)

    Divisibility Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit ...

随机推荐

  1. 从map中取出最大或最小value对应的key---多种写法

    package com.yuwanlong.hashing; import java.util.ArrayList; import java.util.Collections; import java ...

  2. python2和python3 分别连接MySQL的代码

    python2中的写法如下: #coding=utf-8 import MySQLdb try: conn = MySQLdb.connect(host='localhost', port=3306, ...

  3. Python实现KNN算法

    Python实现Knn算法 关键词:KNN.K-近邻(KNN)算法.欧氏距离.曼哈顿距离  KNN是通过测量不同特征值之间的距离进行分类.它的的思路是:如果一个样本在特征空间中的k个最相似(即特征空间 ...

  4. Unity---高度解耦和

    介绍 先举一个简单的例子: 在UGUI中新建一个Button和Text,要求实现点击Button改变Text中的文字. 我的第一反应就是在Button上添加一个脚本,获取点击事件来改变Text的内容. ...

  5. Spark Programming Guide《翻译》

    转载必须注明出处:梁杰帆 在这里要先感谢原作者们!如果各位在这里发现了错误之处,请大家提出 1.Initializing Spark     Spark程序必须做的第一件事就是创建一个SparkCon ...

  6. ubuntu 上安装支付宝安全插件不能运行问题

    1.在ubuntu的firefox浏览器中打开支付宝首页,不能登录,按照提示下载插件 aliedit.tar.gz 2.解压到某个文件夹下,有文件aliedit.sh, 运行 # sh aliedit ...

  7. feign调用过程注意事项

    Feign是Netflix开发的声明式.模板化的HTTP客户端, Feign可以帮助我们更快捷.优雅地调用HTTP API. 在Spring Cloud中,使用Feign非常简单——创建一个接口,并在 ...

  8. Exalogic硬件架构

    1.硬件配置见如下图表. 组件名称 满配 半配 1/4配 1/8配 Sun Rack II 1242 1 1 1 1 计算节点 X2-2.X3-2.X4-2.X5-2.X6-2 30 16 8 4 存 ...

  9. 把查询的结果组织为一串字符(eg:板板鞋,兵乓球,篮球,足球)

    --把查询的结果组织为一串字符(板板鞋,兵乓球,篮球,足球) drop table a create table a( name varchar(20)) insert into a select ' ...

  10. ubuntu下安装谷歌浏览器

    deb 是 Debian Linux 的安装格式,在 ubuntu 中同样可以使用.要安装 deb 安装包,需要使用 dpkg这个终端命令,命令格式如下: $ sudo dpkg -i <pac ...