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. [.net 多线程] Interlocked实现CAS操作

    Interlocked:为多个线程共享的变量提供原子操作. Interlocked.Increment(ref value) 数值加一(原子性操作) Interlocked.Decrement(ref ...

  2. Socket网络通讯

    网络编程 使用C#进行网络编程时,通常都需要用到System.Net命名空间.System.Net.Sockets命名空间和System.Net.Mail命名空间: 1. System.Net命名空间 ...

  3. 六、Note开发工具Visual Studio Code下载安装以及Visual Studio Code的使用

    专业的人干专业的事,我们搞Node总不能真的使用文本编辑器傻乎乎的搞吧,文本编辑器来开发Node程序,效率太低,运行Node程序还需要在命令行单独敲命令.如果还需要调试程序,就更加麻烦了.所以我们需要 ...

  4. 运维利器:钉钉机器人脚本告警(Linux Python 篇)

    写在前面的话 在前面的博客中已经具体提到了如何获取对的机器人的 Token 等操作,不清楚的可以参考之前写的 [运维利器:钉钉机器人脚本告警(Linux Shell 篇)]这篇博客的前部分. 本文主要 ...

  5. 【leetcode 138. 复制带随机指针的链表】解题报告

    方法一:递归 unordered_map<Node*,Node*> dict; Node* copyRandomList(Node* head) { if (!head) return h ...

  6. day2学python 数据类型+深浅拷贝+循环

    数据类型+深浅拷贝+循环 别的语言的数组 python不用定义 直接使用 color=['红','橙','黄','绿','青','蓝','紫'] print(color[1:3]) //打印[1,3) ...

  7. Mysql的用户基本操作

    创建用户: mysql> create user 'cai'@'localhost' identified by '123456'; Query OK, 0 rows affected (0.0 ...

  8. C语言——从入门到精通,从精通到放弃

    从第一次在CB上运行处 Hello World开始,哈哈哈哈,便开始各种幻想,哈哈哈哈,想着这就入门了,哈哈哈哈,我果然是个天才,哈哈哈哈. 后来啊,if-else语句,for 语句,while语句, ...

  9. cnd 计费流量查询服务模块设计与实现

    一.cdn模块结构: 2.内部模块结构:

  10. CentOS 中安装 jdk

    1.检查是否安装jdk  rpm -qa|grep jav [root@hadoop110 opt]# rpm -qa|grep java 2.卸载版本地域1.7 的jdk rpm -e 软件包 [r ...