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. HackNine 避免在EditText中验证日期

    1.概要:    为什么不直接为EditTText设置一个点击监听器,而非要使用Button呢?     答案是:使用Button更安全,因为用户无法修改Button的文本内容.如果使用EditTex ...

  2. C#向服务器上传文件问题

    最近在写服务器端web上传的接口.但一直报错,上传不上去,后来发现是在分隔符中出现的问题. 错误的写法: var boundary = "---------------" + Da ...

  3. C# 筛选Datatable、foreach填充DGV,datatable与datarows转换

    public void SelectFG1(string Nane) { string SetText = "卫材代码 like '%" + Nane + "%' or ...

  4. 使用django进行发送 邮件

    我们来看一下 django发送 邮件的整个流程 第一步:例先去 网易163注册账号并激活发邮件功能 把授权码进行 开启 来到我们的项目setting中进行 一个配置: # 邮箱的配置信息 EMAIL_ ...

  5. linux安装配置阿里云的yum源和python3

    一.yum源理解 yum源仓库的地址 在/etc/yum.repos.d/,并且只能读出第一层的repo文件 yum仓库的文件都是以.repo结尾的 二.下载阿里云的.repo仓库文件 ,放到/etc ...

  6. centos7用docker安装单节点redis4.0.11

    [root@localhost conf]# docker search redisINDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATEDdocker.io d ...

  7. 八大排序算法的python实现(七)基数排序

    代码: #coding:utf-8 #author:徐卜灵 import math #print math.ceil(3.2) 向上取整4.0 #print math.floor(3.2) 向下取整3 ...

  8. flink学习笔记-flink实战

    说明:本文为<Flink大数据项目实战>学习笔记,想通过视频系统学习Flink这个最火爆的大数据计算框架的同学,推荐学习课程: Flink大数据项目实战:http://t.cn/EJtKh ...

  9. Spark调优秘诀——超详细

    版权声明:本文为博主原创文章,转载请注明出处. Spark调优秘诀 1.诊断内存的消耗 在Spark应用程序中,内存都消耗在哪了? 1.每个Java对象都有一个包含该对象元数据的对象头,其大小是16个 ...

  10. js 三大事件(鼠标.键盘.浏览器)

    鼠标事件: click:单击 dblclick:双击 mousedown:鼠标按下 mouseup:鼠标抬起 mouseover:鼠标悬浮(进入) mouseout:鼠标离开(离开) mousemov ...