The shortest problem

Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 0    Accepted Submission(s): 0

Problem Description
In this problem, we should solve an interesting game. At first, we have an integer n, then we begin to make some funny change. We sum up every digit of the n, then insert it to the tail of the number n, then let the new number be the interesting number n. repeat it for t times. When n=123 and t=3 then we can get 123->1236->123612->12361215.
 
Input
Multiple input.
We have two integer n (0<=n<=104 ) , t(0<=t<=105) in each row.
When n==-1 and t==-1 mean the end of input.
 
Output
For each input , if the final number are divisible by 11, output “Yes”, else output ”No”. without quote.
 
Sample Input
35 2
35 1
-1 -1
 
Sample Output
Case #1: Yes
Case #2: No
 
 #include <iostream>
#include <cstdio>
#include <algorithm> using namespace std; /* run this program using the console pauser or add your own getch, system("pause") or input loop */
//int main(int argc, char** argv) #define N 100005 int main()
{
int n, m, d, a, sum, r, nu, t = ; while(scanf("%d%d", &n, &m), n != - || m != -)
{
r = n % ;
sum = ; while(n) // 不知道为什么非得这么写才对~
{
sum += n % ;
n /= ;
} while(m--)
{
a = ;
nu = n = sum; // nu,存当前次数之前出现的根的总和
sum = ; while(n)
{
sum += n % ; // sum存目前的根总和的根
n /= ;
a *= ;
} r = (r * a + nu) % ;
sum += nu;
} if(r == )
printf("Case #%d: Yes\n", t++);
else
printf("Case #%d: No\n", t++);
}
return ;
}
 

The shortest problem(hdu,多校的更多相关文章

  1. (能被11整除的数的特征)The shortest problem --hdu

    链接: http://acm.hdu.edu.cn/contests/contest_showproblem.php?pid=1005&cid=595 若一个整数的个位数字截去,再从余下的数中 ...

  2. hdu 5373 The shortest problem(杭电多校赛第七场)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5373 The shortest problem Time Limit: 3000/1500 MS (J ...

  3. 2015 Multi-University Training Contest 7 hdu 5373 The shortest problem

    The shortest problem Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Oth ...

  4. HDU-5373 The shortest problem

    The shortest problem http://acm.hdu.edu.cn/showproblem.php?pid=5373 Time Limit: 3000/1500 MS (Java/O ...

  5. The shortest problem

    The shortest problem Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others ...

  6. 2018 HDU多校第四场赛后补题

    2018 HDU多校第四场赛后补题 自己学校出的毒瘤场..吃枣药丸 hdu中的题号是6332 - 6343. K. Expression in Memories 题意: 判断一个简化版的算术表达式是否 ...

  7. 2018 HDU多校第三场赛后补题

    2018 HDU多校第三场赛后补题 从易到难来写吧,其中题意有些直接摘了Claris的,数据范围是就不标了. 如果需要可以去hdu题库里找.题号是6319 - 6331. L. Visual Cube ...

  8. 2015 HDU 多校联赛 5363 Key Set

    2015 HDU 多校联赛 5363 Key Set 题目: http://acm.hdu.edu.cn/showproblem.php? pid=5363 依据前面给出的样例,得出求解公式 fn = ...

  9. 2015 HDU 多校联赛 5317 RGCDQ 筛法求解

    2015 HDU 多校联赛 5317 RGCDQ 筛法求解 题目  http://acm.hdu.edu.cn/showproblem.php? pid=5317 本题的数据量非常大,測试样例多.数据 ...

随机推荐

  1. 接口自动化之cookies登录

    现在有很多网站有验证码,跳过验证码实现登录可以使用cookies登录 目录 1.requests的添加cookies的方法 2.举个栗子 1.requests的添加cookies的方法 request ...

  2. VS2012不显示最近打开的文件

    解决: 1.点击开始,在左下角输入“regedit” 2.右击HKEY_CURRENT_USER,点击查找,输入NoRecentDocsHistory 3.右边找到NoRecentDocsHistor ...

  3. CSS中设置字体样式

    <style type="text/css"> body{ font-family: SimHei,"微软雅黑",sans-serif; } < ...

  4. Netty之Page级别的内存分配

    Page 级别的内存分配: 之前我们介绍过, netty 内存分配的单位是chunk, 一个chunk 的大小是16MB, 实际上每个chunk, 都以双向链表的形式保存在一个chunkList 中, ...

  5. echarts之折线图介绍及使用

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  6. Python入门习题10.河内塔(汉诺塔)问题

    例10 共n个圆盘,a,b,c三根柱子 #汉诺塔问题.py def Hanoi(n): #定义n阶汉诺塔问题移动次数函数 if n == 1: return 1 else: return 2*Hano ...

  7. poj Meteor Shower

    这道题是下流星,流星会下到上下左右中的位置,而且有时间的,要你求出最短到达安全位置的时间. 这道题要注意边界是可以超过300的 #include<stdio.h> #include< ...

  8. BZOJ 3703: 昊昊的壮举之造福社会

    传送门 搜索,剪枝 首先可以二分答案迭代加深,假设要买 $p$ 台 那么肯定卖价格最小的 $p$ 台 再来个 $A*$ ,设搜到当前情况时,有 $waste$ 的钱一定要被浪费(其实就是某些学校剩下的 ...

  9. JS :Date日期格式化

    Date.prototype.format = function (formatStr) { var date = this; /* 函数:填充0字符 参数:value-需要填充的字符串, lengt ...

  10. C# 下载PDF文件(http与ftp)

    1.下载http模式的pdf文件(以ASP.NET为例,将PDF存在项目的目录下,可以通过http直接打开项目下的pdf文件) #region 调用本地文件使用返回pdfbyte数组 /// < ...