cf B. Little Dima and Equation
http://codeforces.com/contest/460/problem/B
import java.util.*;
import java.math.*;
public class Main { public static void main(String []args)
{
Scanner cin=new Scanner(System.in);
int a,b,c;
BigInteger a1=new BigInteger("");
BigInteger a10=new BigInteger("");
BigInteger a3=new BigInteger("");
BigInteger [][]cc=new BigInteger[][];
BigInteger []f1=new BigInteger[];
for(int i=; i<=; i++)
{
for(int j=; j<=; j++)
{
BigInteger sum=new BigInteger("");
BigInteger h=new BigInteger(((Integer)i).toString());
int k=;
while(k<=j)
{
sum=sum.multiply(h);
k++;
}
cc[i] [j] =sum;
}
}
a=cin.nextInt(); b=cin.nextInt();c=cin.nextInt();
BigInteger h1=new BigInteger(((Integer)b).toString());
BigInteger h2=new BigInteger(((Integer)c).toString());
int cnt=;
for(int i=; i<=; i++)
{
BigInteger a2=new BigInteger("");
BigInteger hh=new BigInteger(((Integer)i).toString());
BigInteger ans,ans1;
ans=cc[i] [a] .multiply(h1).add(h2);
ans1=ans;
if(ans.compareTo(a1)<=||ans.compareTo(a10)>) continue;
while(!ans.equals(a1))
{
a2=a2.add(ans.mod(a3));
ans=ans.divide(a3);
}
if(a2.equals(hh))
{
f1[cnt] =ans1;
cnt++;
}
}
System.out.println(cnt);
for(int i=; i<cnt; i++)
{
if(i==) System.out.print(f1[i] );
else System.out.print(" "+f1[i] );
}
System.out.print("\n");
}
}
cf B. Little Dima and Equation的更多相关文章
- CodeForces460B. Little Dima and Equation
B. Little Dima and Equation time limit per test 1 second memory limit per test 256 megabytes input s ...
- CF460B Little Dima and Equation (水题?
Codeforces Round #262 (Div. 2) B B - Little Dima and Equation B. Little Dima and Equation time limit ...
- Codeforces Little Dima and Equation 数学题解
B. Little Dima and Equation time limit per test 1 second memory limit per test 256 megabytes input s ...
- B. Little Dima and Equation
time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...
- cf 366D D. Dima and Trap Graph (计算所有线段共同覆盖的某段区间)
http://codeforces.com/problemset/problem/366/D 题意:给出n个点,m条边,a,b,ll,rr分别代表点a,点b相连,点a和点b的区间范围(ll,rr),然 ...
- CF#214 C. Dima and Salad 01背包变形
C. Dima and Salad 题意 有n种水果,第i个水果有一个美味度ai和能量值bi,现在要选择部分水果做沙拉,假如此时选择了m个水果,要保证\(\frac{\sum_{i=1}^ma_i}{ ...
- cf 366C C. Dima and Salad(01背包)
http://codeforces.com/contest/366/problem/C 题意:给出n个水果的两种属性a属性和b属性,然后挑选苹果,选择的苹果必须要满足这样一个条件:,现在给出n,k,要 ...
- codeforces 460B Little Dima and Equation 解题报告
题目链接:http://codeforces.com/problemset/problem/460/B 题目意思:给出a, b, c三个数,要你找出所有在 1 ≤ x ≤ 1e9 范围内满足 x = ...
- codeforces #262 DIV2 B题 Little Dima and Equation
题目地址:http://codeforces.com/contest/460/problem/B 这题乍一看没思路.可是细致分析下会发现,s(x)是一个从1到81的数,不管x是多少.所以能够枚举1到8 ...
随机推荐
- directive 指令
参考文章 : http://www.zouyesheng.com/angular.html#toc20 18. 自定义指令directive http://blog.jobbole.com/62 ...
- 工控主板EM9161对ISO7816协议的支持
在当前的金融POS终端及相关领域,ISO7816通讯协议得到了广泛应用.英创的工控主板EM9161,可在其异步串口的基础上,通过简单的设置,就可把串口转为符合ISO7816协议的接口,实现与各种智能卡 ...
- ISO7816标准IO通讯方面的需求
以下需求适用于符合ISO7816的Reader的测试:换句话说只要Reader能通过以下指令,就基本符合了ISO7816标准,具体需求为: 1 概述 本文档主要描述CDCAS系统中用到的CA证书的格式 ...
- 自制单片机之四……LCD1602的驱动
LCD1602已很普遍了,具体介绍我就不多说了,市面上字符液晶绝大多数是基于HD44780液晶芯片的,控制原理是完全相同的,因此HD44780写的控制程序可以很方便地应用于市面上大部分的字符型液晶.字 ...
- vs2010 suite integration toolkit execution
原因是UltraDeamen的问题,重新换个WinMount来解压ISO文件.完美安装运行
- spring加载properties配置文件
public static void main(String[] args){ String path="E:/workspace/bocMarketData/src/config/P ...
- 关于hibernate中对象的三种状态分析
一,首先hibernate中对象的状态有三种:瞬态.游离态和持久态,三种状态转化的方法都是通过session来调用,瞬态到持久态的方法有save().saveOrUpdate().get().load ...
- 深度剖析JDK动态代理机制
摘要 相比于静态代理,动态代理避免了开发人员编写各个繁锁的静态代理类,只需简单地指定一组接口及目标类对象就能动态的获得代理对象. 代理模式 使用代理模式必须要让代理类和目标类实现相同的接口,客户端通过 ...
- Qt 图形特效(Graphics Effect)介绍
原文链接:Qt 图形特效(Graphics Effect)介绍 QGraphicsEffect也是Qt-4.6引入的一个新功能.它让给图形元素QGraphicsItem增加更佳视觉效果的编程变得非常简 ...
- Oracle 用户、对象权限、系统权限
--================================ --Oracle 用户.对象权限.系统权限 --================================ 一.用户与模式 ...