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. NGINX配置小随笔

    达到以下效果: 1,特定目录被指定IP访问 2,不是指定的IP地址不能执行URI中特定字符串 3,特定目录中不能执行PHP文件 set $self_visit ''; if ( $request_ur ...

  2. [LeetCode 122] - 买入与卖出股票的最佳时机II(Best Time to Buy and Sell Stock II)

    问题 假设你有一个数组,其中的第i个元素表示一只股票在第i天的价格. 设计一个算法找出最大的利润值.你可以进行任意多次的交易(即多次的卖出并买入一份股票).你不能在同一时间进行多次交易(即你必须在再次 ...

  3. android获取屏幕宽高与获取控件宽高

    获取屏幕宽高 // 获取屏幕宽高(方法1) int screenWidth = getWindowManager().getDefaultDisplay().getWidth(); // 屏幕宽(像素 ...

  4. resultMap之collection聚集

    <select id="getCarsWithCollection" resultMap="superCarResult"> select c1.c ...

  5. url中的jsessionid解释

    (1) 这是一个保险措施 因为Session默认是需要Cookie支持的 但有些客户浏览器是关闭Cookie的 这个时候就需要在URL中指定服务器上的session标识,也就是5F4771183629 ...

  6. hdu1573:数论,线性同余方程组

    题目大意: 给定一个N ,m 找到小于N的  对于i=1....m,满足  x mod ai=bi  的 x 的数量. 分析 先求出 同余方程组 的最小解x0,然后 每增加lcm(a1...,am)都 ...

  7. WPF - Build Error总结

    1. are you missing an assembly reference 给项目添加新控件的时候,经常发现这种错误 Error 21 The type or namespace name 'C ...

  8. iOS 原生二维码扫描,带扫描框和扫描过程动画

    在代码中使用了相对布局框架Masonry 准备两张图片,一张是扫描边框,一张是扫描时的细线分别命名 scanFrame.png和scanLine.png并提前放入工程 导入相对布局头文件 #defin ...

  9. 字典树-百度之星-Xor Sum

    Xor Sum Problem Description Zeus 和 Prometheus 做了一个游戏,Prometheus 给 Zeus 一个集合,集合中包括了N个正整数,随后 Prometheu ...

  10. NFinal 视图—模板

    创建模板 1.新建Header.ascx用户控件,此控件就是模板,修改内容如下: <%@ Control Language="C#" AutoEventWireup=&quo ...