2015 多校联赛 ——HDU5373(模拟)
35 1
-1 -1
Case #2: No
对生成的数%11,余数与下次多增的部分结合,不停求余
(官方:用long long 写不好的会超时,是int的四倍 - -)
#include <iostream>
#include <cstdio> using namespace std;
typedef long long ll; int f(int sum)
{
int i = 0;
while(sum>0)
{
sum /= 10;
i++;
} return i;
} int p(int num)
{
int i = f(num);
int sum = 1;
while(i--)
{
sum *= 10;
} return sum;
} int main()
{
int n, t, tt=1;
while(scanf("%d%d", &n, &t))
{
if(n==-1&&t==-1) break; int sum = 0;
int div = 0;
int temp;
int temps; temp = n;
while(temp>0)
{
sum += (temp%10);
temp /= 10;
} for(int i=0; i<t; i++)
{
div = n % 11; n = div*p(sum) + sum; temp = sum;
temps = 0;
while(temp>0)
{
temps += (temp%10);
temp /= 10;
}
sum += temps; }
if(n%11==0) printf("Case #%d: Yes\n", tt++);
else printf("Case #%d: No\n", tt++);
} return 0; }
2015 多校联赛 ——HDU5373(模拟)的更多相关文章
- 2015 多校联赛 ——HDU5319(模拟)
Painter Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Su ...
- 2015 多校联赛 ——HDU5402(模拟)
For each test case, in the first line, you should print the maximum sum. In the next line you should ...
- 2015 多校联赛 ——HDU5334(构造)
Virtual Participation Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Ot ...
- 2015 多校联赛 ——HDU5302(构造)
Connect the Graph Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others ...
- 2015 多校联赛 ——HDU5294(最短路,最小切割)
Tricks Device Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) To ...
- 2015 多校联赛 ——HDU5325(DFS)
Crazy Bobo Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others) Tota ...
- 2015 多校联赛 ——HDU5316(线段树)
Fantasy magicians usually gain their ability through one of three usual methods: possessing it as an ...
- 2015 多校联赛 ——HDU5323(搜索)
Solve this interesting problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ...
- 2015 多校联赛 ——HDU5301(技巧)
Your current task is to make a ground plan for a residential building located in HZXJHS. So you must ...
随机推荐
- fs 创建文件夹
var http = require("http"); var fs = require("fs"); var server = http.createServ ...
- 用python实现简单购物车功能
all_asset = 0 i1 = input("请输入总资产:") all_asset = int(i1) goods = [ {'name':'电脑','price':199 ...
- 实验二Java面向对象程序设计实验报告(2)
实验二 Java面向对象程序设计 实验概述: 课程:程序设计与数据结构 班级:1623班 姓名: 邢天岳 学号:2309 指导老师:娄老师 王老师 实验日期:2017.4.16 实验名称: Java面 ...
- loadrunner下载资源时步骤下载超时 (120 seconds) 已过期
下载资源所用时间超过120秒时,就会报出这个错误,解决方法是设置加大超时时间 运行时设置(快捷键F4) Internet 协议--首选项--高级--选项--General--步骤下载超时(秒) 可以把 ...
- Java 持久化之 --io流与序列化操作
1)File类操作文件的属性 1.File类的常用方法 1. 文件的绝对完整路径:getAbsolutePath() 文件名:getName() 文件相对路径:getPath() 文件的上一级目录:g ...
- (干货)微信小程序之上传图片和图片预览
这几天一直负责做微信小程序这一块,也可以说是边做边学习吧,把自己做的微信小程序的一些功能分享出来,与大家探讨一下,相互学习相互进步. 先看下效果图 只写了一下效果样式的话希望大家不要太在意,下面马路杀 ...
- Python内置函数(12)——str
英文文档: class str(object='') class str(object=b'', encoding='utf-8', errors='strict') Return a string ...
- 新概念英语(1-32)A fine day
新概念英语(1-33)A fine day Where is the Jones family? It is a fine day today. There are some clouds in th ...
- python常见异常
- 找出一个文件夹下后缀名为.jpg的文件
import os list1=os.lisdir('E//') #方法一列表推导式 list2=[i for i in list1 if i.endswith('.jpg')] #方法二for循环 ...