题目链接:http://lightoj.com/volume_showproblem.php?problem=1163

题意:有一个数A,然后去掉A的最后一位得到B,先告诉你A-B的值,求所有满足条件的A,按从小到大的顺序输出;

其实就是x-x/10=n求所有的 x(这里的x/10是取整)

还可以写成是:num*10+r - num = n,其中num*10+r = A, n = B, r是A的个位数字;r一定是0-9中的一个数,可以枚举,所以可以得到 9 * num = n-r;

所以只要找到所有的r是的(n-r)%9 == 0即可;

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <math.h>
typedef unsigned long long LL;
#define N 1000001
using namespace std;
const double eps = 1e-; int main()
{
int T, t = ;
scanf("%d", &T);
while(T --)
{
LL n;
scanf("%llu", &n);
LL ans[] = {};
int k = ;
for(int i=; i<=; i++)
{
if((n-i)% == )
ans[k++] = (n-i)/*+i;
}
sort(ans, ans+k);
k = unique(ans, ans+k) - ans;
printf("Case %d:", t++);
for(int i=; i<k; i++)
printf(" %llu", ans[i]);
printf("\n");
}
return ;
}

LightOj 1163 - Bank Robbery(x-x/10 = n求所有的 x )的更多相关文章

  1. 1163 - Bank Robbery

    1163 - Bank Robbery   In one very cold morning, Mark decides to rob a bank. But while trying hacking ...

  2. Codeforces Round #414 A. Bank Robbery

    A. Bank Robbery time limit per test 2 seconds memory limit per test   256 megabytes   A robber has a ...

  3. C# 求余 int a = 371 / 100 % 10,求a的结果为多少?//nt 和int类型计算得到的结果还是int类型

    //int 和int类型计算得到的结果还是int类型 eg:int a = 371 / 100 % 10,求a的结果为多少? 首先371除以100,再让此结果除以10求余数. 一 371除以100得到 ...

  4. Bank Robbery LightOJ - 1163(推方程 注意计算机的计算方式)

    题意:一个数A,如果A去掉它的最后一位就变成了B,即B=A/10,给A - B,求A #include <iostream> #include <cstdio> #includ ...

  5. 【codeforces 794A】Bank Robbery

    [题目链接]:http://codeforces.com/contest/794/problem/A [题意] 每个位置上可能有物品(>=1)或是没物品 你一开始在某一个位置b; 然后你最左可以 ...

  6. LightOj 1197 - Help Hanzo(分段筛选法 求区间素数个数)

    题目链接:http://lightoj.com/volume_showproblem.php?problem=1197 题意:给你两个数 a b,求区间 [a, b]内素数的个数, a and b ( ...

  7. lightoj 1300 边双联通分量+交叉染色求奇圈

    题目链接:http://lightoj.com/volume_showproblem.php?problem=1300 边双连通分量首先dfs找出桥并标记,然后dfs交叉着色找奇圈上的点.这题只要求在 ...

  8. x的x次幂的值为10,求x的近似值

    public class Main { static double eps = 1e-7; public static void main(String[] args){ double l = 2,r ...

  9. 华为机试题【10】-求数字基root

    题目描述: 求整数的Root:给定正整数,求每位数字之和;如果和不是一位数,则重复; 输入:输入任意一个或多个整数 输出:输出各位数字之和,直到和为个位数为止(输入异常,则返回-1),多行,每行对应一 ...

随机推荐

  1. BZOJ4230: 倒计时

    4230: 倒计时 Time Limit: 10 Sec  Memory Limit: 256 MBSubmit: 20  Solved: 12[Submit][Status][Discuss] De ...

  2. hdu1028 Ignatius and the Princess III

    这是道典型的母函数的题目,可以看看我的母函数这一标签上的另一道例题,里面对母函数做了较为详细的总结.这题仅贴上代码: #include"iostream" using namesp ...

  3. safedog的小技巧

    限制3389连接:下载SafedogServer\SafeDogGuardCenter\ProGuardData.ini回本地,然后本地搭建安全狗,覆盖,查看计算机名,修改自己计算机名再连接. 卸载安 ...

  4. Educational Codeforces Round 15 C. Cellular Network(二分)

    C. Cellular Network time limit per test 3 seconds memory limit per test 256 megabytes input standard ...

  5. discuz怎么根据连接知道调用的是什么模板页面

    其实不怎么难,基本都可以看出discuz是怎么样调用模板页面的 这个是论坛的帖子的列表页,看到url就可以看出是forum目录下的forumdisplay这个模板,forumdisplay.html这 ...

  6. GTX 680 Kepler

    http://www.nvidia.com/object/nvidia-kepler.html http://www.geforce.com/hardware/desktop-gpus/geforce ...

  7. NEC学习 ---- 布局 -两列, 右侧定宽,左侧自适应

    该篇必须引用初始化样式和功能性样式,样式在前篇 http://www.cnblogs.com/Zell-Dinch/p/4436054.html 中已经提及. 上篇中介绍了左侧定宽,右侧自适应的布局, ...

  8. C# vba 操作 Word

    添加引用 Microsoft Word  *.0 Object Library Microsoft Graph *.0 Object Library 变量说明 Object oMissing = Sy ...

  9. PHP7革新与性能优化

    有幸参与2015年的PHP技术峰会(PHPCON),听了鸟哥(惠新宸)的关于PHP7的新特性和性能优化的分享,一切都令人感到激动.鸟哥是国内最权威的PHP专家,他的分享有很多非常有价值的东西,我通过整 ...

  10. MYSQL PASSWORD()

    https://www.pythian.com/blog/hashing-algorithm-in-mysql-password-2/ SELECT PASSWORD ("this_is_a ...