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的更多相关文章

  1. CodeForces460B. Little Dima and Equation

    B. Little Dima and Equation time limit per test 1 second memory limit per test 256 megabytes input s ...

  2. CF460B Little Dima and Equation (水题?

    Codeforces Round #262 (Div. 2) B B - Little Dima and Equation B. Little Dima and Equation time limit ...

  3. Codeforces Little Dima and Equation 数学题解

    B. Little Dima and Equation time limit per test 1 second memory limit per test 256 megabytes input s ...

  4. B. Little Dima and Equation

    time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...

  5. 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),然 ...

  6. CF#214 C. Dima and Salad 01背包变形

    C. Dima and Salad 题意 有n种水果,第i个水果有一个美味度ai和能量值bi,现在要选择部分水果做沙拉,假如此时选择了m个水果,要保证\(\frac{\sum_{i=1}^ma_i}{ ...

  7. cf 366C C. Dima and Salad(01背包)

    http://codeforces.com/contest/366/problem/C 题意:给出n个水果的两种属性a属性和b属性,然后挑选苹果,选择的苹果必须要满足这样一个条件:,现在给出n,k,要 ...

  8. codeforces 460B Little Dima and Equation 解题报告

    题目链接:http://codeforces.com/problemset/problem/460/B 题目意思:给出a, b, c三个数,要你找出所有在 1 ≤ x ≤ 1e9 范围内满足 x =  ...

  9. codeforces #262 DIV2 B题 Little Dima and Equation

    题目地址:http://codeforces.com/contest/460/problem/B 这题乍一看没思路.可是细致分析下会发现,s(x)是一个从1到81的数,不管x是多少.所以能够枚举1到8 ...

随机推荐

  1. Javascript 原型注意事项

    function abc() {} abc.prototype.xx = { name: "keatkeat" } var x = new abc(); x.xx.name = & ...

  2. 自制单片机之十七……PC与单片机RS-232串口的通讯和控制

    这次我们来试着一步步的去掌握PC与单片机通过RS-232进行通讯和控制. 先说说我硬件的情况.我用的PC是个二手的IBM240小本本,十寸屏,赛扬400,机子很老了.但也有它的优点:1.串口,并口,P ...

  3. Android 使用HorizontalScrollView 实现Gallery效果

    Gallery(画廊)是一个锁定中心条目并且拥有水平滚动列表的视图,一般用来浏览图片,并且可以响应事件显示信息:Gallery还可以和ImageSwitcher组件结合使用来实现一个通过缩略图来浏览图 ...

  4. poj3237--Tree 树链剖分

    题意:三种操作 ①修改第i条边的权值为val,②把u到v路径上的所有边的权值 去相反数③求u 到v路径上最大的边权 线段树的区间更新还是不熟练,,一直搞不对调试了好久还是没对,最后还是看的kuangb ...

  5. Thinkphp 3.2 中词分词 加权搜索

    原文地址:http://www.cnblogs.com/kekukele/p/4544349.html 前段时间,利用业余时间做了一个磁力搜索的网站Btdog,其中使用到了简单的中文分词与加权搜索,在 ...

  6. sicily 1155 Can I Post the letter

    题意:判断有向图两点之间是否可通达! 解法:深搜或广搜(注意避免旧路重行) DFS: #include<iostream> #include<vector> #include& ...

  7. 关于maven-jetty-plugin 自动重启问题

    <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin ...

  8. select与epoll分析

    关于select与epoll的区别,网上的文章已是一大堆.不过别人的终究是别人的,总得自己去理解才更深刻.于是在阅读了大量的文章后,再装模作样的看下源码,写下了自己的一些理解. 在开始之前,要明白li ...

  9. Web Service 初步了解

    Web Service见名之意就是网络上的一些服务,解决的问题就是如何使用这些服务,因为软件的开发有各种各样的语言,利用Java,C#,VB.NET,PHP等等,如何使这些语言编写的程序能够进行互通, ...

  10. Log4j使用说明

    Log4J实例应用开发 在实际编程时,要使Log4j真正在系统中运行事先还要对配置文件进行定义.定义步骤就是对Logger.Appender及Layout的分别使用.Log4j支持两种配置文件格式,一 ...