当前位置:网站首页>Codeforces Round #392 (Div. 2) D. Ability To Convert
Codeforces Round #392 (Div. 2) D. Ability To Convert
2022-06-24 09:34:00 【No toast】
#include<bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define eps 1e-2
#define gcd __gcd
#define pb push_back
#define PI acos(-1.0)
#define lowbit(x) (x)&(-x)
#define bug printf("!!!!!\n");
#define mem(x,y) memset(x,y,sizeof(x))
#define int long long
typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef unsigned long long uLL;
const int maxn = 1e5+2;
const int INF = 1<<30;
const int mod = 1e9+7;
int n;string s;
void solve(){
cin>>n>>s;
int st,ed=s.size()-1;
LL ans=0,mul=1;
while(ed>=0){
int tmp=0;
for(int i=0;i<=ed;i++){
if(ed-i>15) continue;
tmp=0;
for(int j=i;j<=ed;j++)
tmp=tmp*10+s[j]-'0';
if(tmp<n){
st=i;break;}
}
while(st<ed&&s[st]=='0') ++st;
ans=ans+mul*tmp;mul=mul*n;ed=st-1;
}
cout<<ans<<endl;
return;
}
int32_t main()
{
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
// ios::sync_with_stdio(false);
int t = 1;
//scanf("%d",&t);
while(t--){
// printf("Case %d: ",cas++);
solve();
}
return 0;
}
边栏推荐
- Zero foundation self-study SQL course | syntax sequence and execution sequence of SQL statements
- 浮点数表示法(总结自CS61C和CMU CSAPP)
- Some common pitfalls in getting started with jupyter:
- Netrca: an effective network fault cause localization
- Squid proxy application
- tp5 使用post接收数组数据时报variable type error: array错误的解决方法
- Depens:*** but it is not going to be installed
- L01_ How is an SQL query executed?
- 正则匹配邮箱
- Event registration Apache pulsar x kubesphere online meetup hot registration
猜你喜欢

tp5 使用post接收数组数据时报variable type error: array错误的解决方法

2022.06.23 (traversal of lc_144,94145\

零基础自学SQL课程 | 相关子查询
![[redis implements seckill business ①] seckill process overview | basic business implementation](/img/a3/9a50e83ece43904a3a622dcdb05b3c.png)
[redis implements seckill business ①] seckill process overview | basic business implementation

Linux (centos7.9) installation and deployment of MySQL Cluster 7.6

ThinkPHP5多语言切换项目实战

The ambition of JD instant retailing from 618

Redis implements a globally unique ID

Ordinary people have no education background. Can they earn more than 10000 yuan a month by Self-taught programming?

深入解析 Apache BookKeeper 系列:第三篇——读取原理
随机推荐
Remote connection of raspberry pie without display by VNC viewer
Directly applicable go coding specification
What do you mean by waiting for insurance records? Where should I go for filing?
NLP-D59-nlp比赛D28—我想,也好—阶段总结—心态调整
PTA猴子选大王(约瑟夫环问题)
Longest public prefix of leetcode
LeetCode: 137. 只出现一次的数字 II
每周推薦短視頻:談論“元宇宙”要有嚴肅認真的態度
[bug] @jsonformat has a problem that the date is less than one day when it is used
目标检测系列——Fast R-CNN
PostgreSQL
软件系统依赖关系分析
Zero foundation self-study SQL course | syntax sequence and execution sequence of SQL statements
Chapter 7 operation bit and bit string (III)
Threejs glow channel 01 (unrealbroompass & layers)
获取带参数的微信小程序二维码-以及修改二维码LOGO源码分享
leetcode--链表
ThinkPHP5多语言切换项目实战
Learning Tai Chi Maker - esp8226 (XIII) OTA
When programmers are asked if they can repair computers... | daily anecdotes