当前位置:网站首页>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;
}
边栏推荐
- Linux MySQL installation
- [noi Simulation Competition] send (tree DP)
- 什么情况下应该使用GridFS?
- 谈谈数字化转型晓知识
- P6117-[joi 2019 final] greedy
- 牛客网 字符串变形
- Codeforces Round #392 (Div. 2) D. Ability To Convert
- Recommendation - Secret of curiosity: how many dancing angels can stand on the tip of a needle?
- ApplicationContextInitializer的三种使用方法
- Linux (centos7.9) installation and deployment of MySQL Cluster 7.6
猜你喜欢

活动报名|Apache Pulsar x KubeSphere 在线 Meetup 火热报名中

Event registration Apache pulsar x kubesphere online meetup hot registration

R 椭圆随机点产生并画图

Epidemic situation, unemployment, 2022, we shouted to lie down!

Zero foundation self-study SQL course | having clause
![[redis realize Secondary killing Business ①] Overview of Secondary killing Process | Basic Business Realization](/img/a3/9a50e83ece43904a3a622dcdb05b3c.png)
[redis realize Secondary killing Business ①] Overview of Secondary killing Process | Basic Business Realization

PhpStrom代码格式化设置

支持向量机(SVC,NuSVC,LinearSVC)

嵌入式 | 硬件转软件的几条建议

Inspiration from reading CVPR 2022 target detection paper
随机推荐
Learn Tai Chi Maker - esp8226 (12) esp8266 multitasking
【输入法】迄今为止,居然有这么多汉字输入法!
ThinkPHP5多语言切换项目实战
LeetCode: 377. 组合总和 Ⅳ
Learning Tai Chi Maker - esp8226 (XIII) OTA
PhpStrom代码格式化设置
【Redis实现秒杀业务①】秒杀流程概述|基本业务实现
[noi simulation] pendulum (linear algebra, Du Jiao sieve)
Squid代理服务器应用
PHP封装一个文件上传类(支持单文件多文件上传)
2022.6.13-6.19 AI行业周刊(第102期):职业发展
【gdb调试工具】| 如何在多线程、多进程以及正在运行的程序下调试
零基础自学SQL课程 | 子查询
Depens:*** but it is not going to be installed
Jincang KFS replicator installation (oracle-kes)
Squid proxy application
百度AI模板 获取知识理解
解决:jmeter5.5在win11下界面上的字特别小
Solution: the word of jmeter5.5 on the win11 lower interface is very small
LeetCode: 240. 搜索二维矩阵 II