tjut 2889
来源:互联网 发布:淘宝大学官网 编辑:程序博客网 时间:2024/05/17 21:42
#include <algorithm>#include <iostream>#include <cstdlib>#include <cstdio>#include <string>#include <cmath>#include <stack>#include <queue>#include <set>#include <map>using namespace std;char a[20], b[20];__int64 parseInt64(const char * p, int radix){__int64 v = 0;for(size_t i = 0; i < strlen(p); ++i){ v = v * radix + p[i] - '0';}return v;}__int64 getWithoutZeroValue(__int64 rank){memset(a, '1', sizeof(a));__int64 val = 0;for(int idx = 0; ; ++idx){ val = val * 9 + a[idx] - '0'; if(val == rank){ a[idx+1] = 0; return parseInt64(a, 10); } else if(val > rank){ a[idx] = 0; break; }}for(size_t i = 0; i < strlen(a); ++i){ for(char j = '2'; j <= '9'; ++j){ a[i] = j; val = parseInt64(a, 9); if(val == rank){ return parseInt64(a, 10); } if(val > rank){ a[i] = j - 1; break; } }} return 0;}int main(){while(scanf("%s%s", b, a) != EOF){ __int64 rank = parseInt64(b, 9) - parseInt64(a, 9); printf("%I64d\n", getWithoutZeroValue(rank));}return 0;}
0 0
- tjut 2889
- tjut 5289
- tjut 5288
- tjut 5294
- tjut 2586
- tjut 5296
- tjut 5297
- tjut 5299
- tjut 5384
- tjut 5387
- tjut 5386
- tjut 5381
- tjut 5400
- tjut 5399
- tjut 5396
- tjut 5398
- tjut 5412
- tjut 5410
- 144 Linux使用jstat命令查看jvm的GC情况
- 幼儿园都教什么?
- 微信自动回复和自动抢红包实现原理(一):AccessibilityService的介绍和配置
- SessionFactory (org.hibernate.SessionFactory)
- HDU 5152 线段树+欧拉函数
- tjut 2889
- LDD字符驱动学习
- 存储过程和函数的区别
- Android 开发资源收集(开源项目、教程等)
- Spring Tool Suite(sts)中安装svn插件简介
- 微信自动回复和自动抢红包实现原理(二):自动回复
- ubuntu 14.04 安装 gcc 6.1 心得
- 各种位置和高度计算:.position()、.offset()、.outerHeight()、.scrollTop、.scrollHeight、.clientHeight
- 2016.08.13【初中部 NOIP提高组 】模拟赛C总结