codeforces 488A. Giga Tower 解题报告
题目链接: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 解题报告的更多相关文章
- Codeforces Round 665 赛后解题报告(暂A-D)
Codeforces Round 665 赛后解题报告 A. Distance and Axis 我们设 \(B\) 点 坐标为 \(x(x\leq n)\).由题意我们知道 \[\mid(n-x)- ...
- Codeforces Round 662 赛后解题报告(A-E2)
Codeforces Round 662 赛后解题报告 梦幻开局到1400+的悲惨故事 A. Rainbow Dash, Fluttershy and Chess Coloring 这个题很简单,我们 ...
- Codeforces Round #277.5 解题报告
又熬夜刷了cf,今天比正常多一题.比赛还没完但我知道F过不了了,一个半小时贡献给F还是没过--应该也没人Hack.写写解题报告吧= =. 解题报告例如以下: A题:选择排序直接搞,由于不要求最优交换次 ...
- codeforces B. Simple Molecules 解题报告
题目链接:http://codeforces.com/problemset/problem/344/B 题目意思:这句话是解题的关键: The number of bonds of an atom i ...
- 【LeetCode】799. Champagne Tower 解题报告(Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 动态规划 参考资料 日期 题目地址:https:// ...
- codeforces 591A. Wizards' Duel 解题报告
题目链接:http://codeforces.com/problemset/problem/591/A 题目意思:其实看下面这幅图就知道题意了,就是Harry 和 He-Who-Must-Not-Be ...
- codeforces 582A. GCD Table 解题报告
题目链接:http://codeforces.com/problemset/problem/582/A 网上很多题解,就不说了,直接贴代码= = 官方题解: http://codeforces.com ...
- codeforces 581C. Developing Skills 解题报告
题目链接:http://codeforces.com/problemset/problem/581/C 题目意思:给出 n 个数:a1, a2, ..., an (0 ≤ ai ≤ 100).给出值 ...
- codeforces 577B. Modulo Sum 解题报告
题目链接:http://codeforces.com/problemset/problem/577/B 题目意思:就是给出 n 个数(a1, a2, ..., an) 和 m,问能不能从这 n 个数中 ...
随机推荐
- 【CodeForces 602A】C - 特别水的题3-Two Bases
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=102271#problem/C Description After seeing the ...
- Opencv显示图片并监听鼠标坐标
#include <opencv2/imgproc/imgproc.hpp> #include <opencv2/highgui/highgui.hpp> #include & ...
- POJ3259Wormholes(判断是否存在负回路)
Wormholes Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 38300 Accepted: 14095 Descr ...
- ASP.NET MVC 3 loginUrl自动变成Account/Login,并且发生404错误的解决方法
http://www.cnblogs.com/think8848/archive/2011/07/08/2100814.html ASP.NET MVC 3 loginUrl自动变成Account/L ...
- Request.InputStream 接收Post Data
今天 用 Request.Form /Request.Params 等怎么也获取不到客户发过来的Post 数据 后来试着用了 Request.InputStream 竟然可以 using (Syste ...
- jsp------实现MD5加密
index.jsp <%@ page language="java" import="java.util.*" pageEncoding="UT ...
- 【wget】一条命令轻松备份博客(包括图片)
h2:first-child, body>h1:first-child, body>h1:first-child+h2, body>h3:first-child, body>h ...
- DEEP LEARNING WITH STRUCTURE
DEEP LEARNING WITH STRUCTURE Charlie Tang is a PhD student in the Machine Learning group at the Univ ...
- SqlServer 连接字符串多种配置
Application Name(应用程序名称):应用程序的名称.如果没有被指定的话,它的值为.NET SqlClient Data Provider(数据提供程序). AttachDBFilenam ...
- .Net开源工作流Roadflow的使用与集成(转)
序言 最近公司要整理公司内部oa系统,需要使用到工作流,所以就开始了开源工作流挑选,使用,到集成到公司内部系统的工作. 首先在网上搜了文档,自己也有补充,整理啦国内几款工作流的比较,由于没有个个击破式 ...