HDU-4952 Number Transformation
http://acm.hdu.edu.cn/showproblem.php?pid=4952
Number Transformation
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 171 Accepted Submission(s):
69
He does the
following operations k times. In the i-th operation, x becomes the least integer
no less than x, which is the multiple of i.
He wants to know what is the
number x now.
0".
For each test case, the only one line contains two integers
x,k(1<=x<=10^10, 1<=k<=10^10).
k is the case number counting from 1.
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
__int64 x,i,k,j;
int t=;
while(~scanf("%I64d%I64d",&x,&k))
{
if(x==&&k==)
break;
i=;
while(i<=k)
{
if(x%i!=)
{
j=x/i+;//求倍数。
if(j<=i)
{
x=k*j;
break;
}
x=j*i;
}
else
{
j=x/i;
if(j<=i)
{
x=k*j;
break;
}
}
i++;
}
printf("Case #%d: %I64d\n",t++,x);
}
return ;
}
HDU-4952 Number Transformation的更多相关文章
- hdu 4952 Number Transformation (找规律)
题目链接 题意:给你个x,k次操作,对于第i次操作是:要找个nx,使得nx是>=x的最小值,且能整除i,求k次操作后的数 分析: 经过打表找规律,会发现最后的x/i,这个倍数会趋于一个固定的值, ...
- HDU 4952 Number Transformation 多校8 机智数学
哎.这个题想了好久,状态不对啊...一个大家都出的题..当时想到肯定是可以有什么规律来暴力,不用算到10的10次方 对于某个k,x.从1到k循环,每次求一个新的x,这个x要大于等于原x,并且要是i的倍 ...
- hdu4952 Number Transformation (找规律)
2014多校 第八题 1008 2014 Multi-University Training Contest 8 4952 Number Transformation Number Transform ...
- HDU 1711 Number Sequence(数列)
HDU 1711 Number Sequence(数列) Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Ja ...
- HDU 1005 Number Sequence(数列)
HDU 1005 Number Sequence(数列) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Jav ...
- bzoj 3858: Number Transformation 暴力
3858: Number Transformation Time Limit: 1 Sec Memory Limit: 64 MBSubmit: 82 Solved: 41[Submit][Sta ...
- CodeForces346 C. Number Transformation II
C. Number Transformation II time limit per test 1 second memory limit per test 256 megabytes input s ...
- Codeforces 251C Number Transformation
Number Transformation 我们能发现这个东西是以2 - k的lcm作为一个循环节, 然后bfs就好啦. #include<bits/stdc++.h> #define L ...
- HDU 1005 Number Sequence(数论)
HDU 1005 Number Sequence(数论) Problem Description: A number sequence is defined as follows:f(1) = 1, ...
随机推荐
- (转) linux虚拟机中和主机三种网络连接方式的区别
在介绍网络模式之前,关于网络的几个简单命令的使用 ifup eth0 //启动网卡eth0 ifdown eth0 //关闭网卡eth0 /etc/network/interfaces //网络 ...
- 《你不常用的c#之一》:略谈unsafe
转自csdn:http://blog.csdn.net/robingaoxb/article/details/6199508 msdn里讲到: “在 C# 中很少需要使用指针,但仍有一些需要使用的情况 ...
- javascript类继承系列一
js中没有提供类(class,抽象类,接口等高级的抽象),可以用new,但new的function的对象,构造器 但在js中可以通过function来模拟类的一些特性function fun_name ...
- MYSQL使用指南(下)
在上篇我们讲了登录.增加用户.密码更改等问题.下篇我们来看看MySQL中有关数据库方面的操作.注意:你必须首先登录到MYSQL中,以下操作都是在MYSQL的提示符下进行的,而且每个命令以分号结束. 一 ...
- ios7 苹果原生二维码扫描(和微信类似)
在ios7苹果推出了二维码扫描,以前想要做二维码扫描,只能通过第三方ZBar与ZXing. ZBar在扫描的灵敏度上,和内存的使用上相对于ZXing上都是较优的,但是对于 “圆角二维码” 的扫描确很困 ...
- [转载] java中byte数组与int,long,short间的转换
文章转载自http://blog.csdn.net/leetcworks/article/details/7390731 package com.util; /** * * <ul> * ...
- 『重构--改善既有代码的设计』读书笔记----Replace Array with Object
如果你有一个数组,其中的元素各自代表不同东西,比如你有一个 QList<QString> strList; 其中strList[0]代表选手姓名,strList[1]代表选手家庭住址,很显 ...
- 【实习记】2014-08-26都是回车惹的祸——shell脚本必须是unix行尾
事情由起:svn的url在excel里,我复制到txt文本下,vi做些文本处理,只提取了url,保存为url.txt.再用vi处理url.txt,加上svn checkout等词,变成可以运行 ...
- iOS: 学习笔记, 用代码驱动自动布局实例(swift)
iOS自动布局是设置iOS界面的利器.本实例展示了如何使用自动布局语言设置水平布局, 垂直布局1. 创建空白iOS项目(swift)2. 添加一个控制器类, 修改YYAppDelegate.swift ...
- C# Json反序列化处理
最近换工作了 从客户端转到Web端 第一个任务就是去别人的页面上抓取数据 用到的是JSON 因为他们网站json的格式有点怪 所以 就在JSON反序列化上面 花了一点时间 首先用到的工具是http:/ ...