http://codeforces.com/contest/460/problem/B

  1. import java.util.*;
  2. import java.math.*;
  3. public class Main {
  4.  
  5. public static void main(String []args)
  6. {
  7. Scanner cin=new Scanner(System.in);
  8. int a,b,c;
  9. BigInteger a1=new BigInteger("");
  10. BigInteger a10=new BigInteger("");
  11. BigInteger a3=new BigInteger("");
  12. BigInteger [][]cc=new BigInteger[][];
  13. BigInteger []f1=new BigInteger[];
  14. for(int i=; i<=; i++)
  15. {
  16. for(int j=; j<=; j++)
  17. {
  18. BigInteger sum=new BigInteger("");
  19. BigInteger h=new BigInteger(((Integer)i).toString());
  20. int k=;
  21. while(k<=j)
  22. {
  23. sum=sum.multiply(h);
  24. k++;
  25. }
  26. cc[i] [j] =sum;
  27. }
  28. }
  29. a=cin.nextInt(); b=cin.nextInt();c=cin.nextInt();
  30. BigInteger h1=new BigInteger(((Integer)b).toString());
  31. BigInteger h2=new BigInteger(((Integer)c).toString());
  32. int cnt=;
  33. for(int i=; i<=; i++)
  34. {
  35. BigInteger a2=new BigInteger("");
  36. BigInteger hh=new BigInteger(((Integer)i).toString());
  37. BigInteger ans,ans1;
  38. ans=cc[i] [a] .multiply(h1).add(h2);
  39. ans1=ans;
  40. if(ans.compareTo(a1)<=||ans.compareTo(a10)>) continue;
  41. while(!ans.equals(a1))
  42. {
  43. a2=a2.add(ans.mod(a3));
  44. ans=ans.divide(a3);
  45. }
  46. if(a2.equals(hh))
  47. {
  48. f1[cnt] =ans1;
  49. cnt++;
  50. }
  51. }
  52. System.out.println(cnt);
  53. for(int i=; i<cnt; i++)
  54. {
  55. if(i==) System.out.print(f1[i] );
  56. else System.out.print(" "+f1[i] );
  57. }
  58. System.out.print("\n");
  59. }
  60. }

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. Zookeeper,也要接触起来啦

    分布式的东东,就是部署也方便,但管理,想法,大集群应用是要点...! 参考如下URL简单实现 ,以后应用时多留意. http://blog.csdn.net/shirdrn/article/detai ...

  2. Qt C++中的关键字explicit——防止隐式转换(也就是Java里的装箱),必须写清楚

    最近在复习QT,准备做项目了,QT Creator 默认生成的代码 explicit Dialog(QWidget *parent = 0)中,有这么一个关键字explicit,用来修饰构造函数.以前 ...

  3. ECMAScript 5/6/7兼容性速查表

    http://kangax.github.io/compat-table/es5/ 秒查ECMAScript在各大浏览器的兼容性,点击右上角按钮可以“在5/6/7/非标”之间切换.做JavaScrip ...

  4. 【Xamarin 开发 IOS --IOS ViewController生命周期】

    ViewController ViewController是IOS开发中MVC模式中的C,ViewController是view的controller,ViewController的职责主要包括管理内 ...

  5. Android文件下载(实现断点续传)

    本文将介绍在android平台下如何实现多线程下载,大家都知道,android平台使用java做为开发语言,所以java中支持的多线程下载方式在android平台下都支持,其中主要有两种方式可以实现多 ...

  6. centerOS安装rkhunter

    rkhunter是专业检测系统是否感染rootkit的一个工具: rkhunter-1.4.2.tar.gz 解压后直接安装: #./installer.sh --layout defualt --i ...

  7. 图片实时预览JSP加js

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  8. CSS3 动画触发事件

    @keyframes mymove { 0% {top:0px; left:0px; background:red;} 25% {top:0px; left:100px; background:blu ...

  9. Linux基本操作 1-----命令行BASH的基本操作

    1 Shell(壳)是用户与操作系统底层(通常是内核)之间交互的中介程序,负责将用户指令.操作传递给操作系统底层 shell 分为两种 CUI : Command Line Interface Lin ...

  10. linux性能优化常用命令

    作为一名linux系统管理员,最主要的工作是优化系统配置,使应用在系统上以最优的状态运行,但是由于硬件问题.软件问题.网络环境等的复杂性 和多变性,导致对系统的优化变得异常复杂,如何定位性能问题出在哪 ...