当前位置:网站首页>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;
}
边栏推荐
- 十二、所有功能实现效果演示
- php文件锁
- Some common pitfalls in getting started with jupyter:
- 从618看京东即时零售的野心
- 每周推荐短视频:谈论“元宇宙”要有严肃认真的态度
- June 13-19, 2022 AI industry weekly (issue 102): career development
- Solution: the word of jmeter5.5 on the win11 lower interface is very small
- Go 语言项目开发实战目录
- 金仓KFS replicator安装(Oracle-KES)
- What do you mean by waiting for insurance records? Where should I go for filing?
猜你喜欢

深入解析 Apache BookKeeper 系列:第三篇——读取原理

最新Windows下Go语言开发环境搭建+GoLand配置

L01_ How is an SQL query executed?

Zero foundation self-study SQL course | sub query

Rpiplay implementation of raspberry pie airplay projector

CF566E-Restoring Map【bitset】

NETRCA: AN EFFECTIVE NETWORK FAULT CAUSE LOCALIZATION之论文阅读

荐书丨《好奇心的秘密》:一个针尖上可以站多少跳舞的小天使?

Groovy通过withCredentials获取Jenkins凭据

Recommendation - Secret of curiosity: how many dancing angels can stand on the tip of a needle?
随机推荐
Thinkphp5清除runtime下的cache缓存,temp缓存,log缓存
php文件锁
The printed object is [object object]. Solution
2021-05-20computed and watch applications and differences
Recommendation - Secret of curiosity: how many dancing angels can stand on the tip of a needle?
jupyter入门常见的几个坑:
Groovy通过withCredentials获取Jenkins凭据
从618看京东即时零售的野心
Event registration Apache pulsar x kubesphere online meetup hot registration
支持向量机(SVC,NuSVC,LinearSVC)
转:三星电子CEO:一切决策都要从认清自己开始
P6698-[balticoi 2020 day2] virus [AC automata, DP, SPFA]
百度AI模板 获取知识理解
Niuke network decimal integer to hexadecimal string
浮点数表示法(总结自CS61C和CMU CSAPP)
学习太极创客 — ESP8226 (十二)ESP8266 多任务处理
LeetCode: 377. 组合总和 Ⅳ
Lu Qi: I am most optimistic about these four major technology trends
Depens:*** but it is not going to be installed
Depens:*** but it is not going to be installed