题目链接:http://codeforces.com/problemset/problem/488/A

题目意思:给出一个数a,范围是[-10^9, 10^9],问它最少需要加的一个正整数 b 是多少,条件是加完之后这个数至少有一位有 8.

  有一个小小的意外,改了好久啊~~~~负数的情况,需要乘上 -1,再判断。

 #include <iostream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std; typedef __int64 LL; bool get_eight(LL x)
{
if (x < )
x *= (-);
while (x)
{
LL k = x % ;
if (k == )
return true;
x /= ;
}
return false;
} int main()
{
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
#endif // ONLINE_JUDGE LL a;
while (scanf("%I64d", &a) != EOF)
{
LL cnt = ;
for (LL i = a+; ; i++)
{
if (!get_eight(i))
cnt++;
else
break;
}
printf("%I64d\n", cnt);
}
return ;
}

codeforces 488A. Giga Tower 解题报告的更多相关文章

  1. Codeforces Round 665 赛后解题报告(暂A-D)

    Codeforces Round 665 赛后解题报告 A. Distance and Axis 我们设 \(B\) 点 坐标为 \(x(x\leq n)\).由题意我们知道 \[\mid(n-x)- ...

  2. Codeforces Round 662 赛后解题报告(A-E2)

    Codeforces Round 662 赛后解题报告 梦幻开局到1400+的悲惨故事 A. Rainbow Dash, Fluttershy and Chess Coloring 这个题很简单,我们 ...

  3. Codeforces Round #277.5 解题报告

    又熬夜刷了cf,今天比正常多一题.比赛还没完但我知道F过不了了,一个半小时贡献给F还是没过--应该也没人Hack.写写解题报告吧= =. 解题报告例如以下: A题:选择排序直接搞,由于不要求最优交换次 ...

  4. codeforces B. Simple Molecules 解题报告

    题目链接:http://codeforces.com/problemset/problem/344/B 题目意思:这句话是解题的关键: The number of bonds of an atom i ...

  5. 【LeetCode】799. Champagne Tower 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 动态规划 参考资料 日期 题目地址:https:// ...

  6. codeforces 591A. Wizards' Duel 解题报告

    题目链接:http://codeforces.com/problemset/problem/591/A 题目意思:其实看下面这幅图就知道题意了,就是Harry 和 He-Who-Must-Not-Be ...

  7. codeforces 582A. GCD Table 解题报告

    题目链接:http://codeforces.com/problemset/problem/582/A 网上很多题解,就不说了,直接贴代码= = 官方题解: http://codeforces.com ...

  8. codeforces 581C. Developing Skills 解题报告

    题目链接:http://codeforces.com/problemset/problem/581/C 题目意思:给出 n 个数:a1, a2, ..., an (0 ≤ ai ≤ 100).给出值 ...

  9. codeforces 577B. Modulo Sum 解题报告

    题目链接:http://codeforces.com/problemset/problem/577/B 题目意思:就是给出 n 个数(a1, a2, ..., an) 和 m,问能不能从这 n 个数中 ...

随机推荐

  1. Android intent传递list或对象

    方法一: 如果单纯的传递List<String> 或者List<Integer>的话 就可以直接使用 Java代码 intent.putStringArrayListExtra ...

  2. Python装饰器笔记

    DRY(Don't Repeat Yourself)原则: 一般是指在写代码的时候尽量避免重复的实现.违反DRY原则导致的坏处很容易理解,例如维护困难,修改时一旦遗漏就会产生不易察觉的问题. 一.函数 ...

  3. IQ测试

    1.4个人过桥,只能两两过桥,且只有一盏灯,必须有灯才能过桥,4个人过桥时间分别为1,2,5,10分钟,最短多少时间可以过桥? 答案:1和2先走,1再返回,花3分钟.5和10走,2回去,花了3+10+ ...

  4. php两种导出excel的方法

    所需要的:jquery库,phpexcel插件,页面导出excel效果测试文件explode.php,excel导出功能实现文件exp.php和explode_excel.php,文件相关内容在此文下 ...

  5. Extreme Learning Machine(ELM)的工程哲学

    Extreme Learning Machine(ELM)的工程哲学 David_Wang2015 发布于2015年5月6日 11:29 工程问题往往需要的是一定精度范围内的结果,而不是“真正的”结果 ...

  6. 旋转屏幕时,假如自定义的xib大小变了,可能是这个属性没有修改

    虽然xib内部启用了自动布局,但是当xib放入外界,xib自身的autoresizing是存在的

  7. python numpy 教程

    http://blog.chinaunix.net/uid-21633169-id-4408596.html

  8. C# 根据IP地址获取城市

    using System; using System.IO; using System.Net; using System.Text; using System.Web.Script.Serializ ...

  9. WPF 数据绑定基础

    纯理论,可能会枯燥. .net 技术群: 199281001 ,欢迎加入. 1.目标对象一定是派生自DependencyObject的对象,并且目标属性必须是依赖属性,否则数据绑定操作将会失   败. ...

  10. linux rpm 安装包 信息查询

    来源:http://blog.csdn.net/namesliu/article/details/6004388 以CentOS5.5 中已经集成安装了 Apache.MySQL.PHP作为样例,我们 ...