当前位置:网站首页>Codeforces Round #392 (Div. 2) D. Ability To Convert
Codeforces Round #392 (Div. 2) D. Ability To Convert
2022-06-24 08:12:00 【不吃土司边】
#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;
}
边栏推荐
- Vidéo courte recommandée chaque semaine: Soyez sérieux en parlant de "métaunivers"
- Threejs glow channel 01 (unrealbroompass & layers)
- 12、 Demonstration of all function realization effects
- CDGA|到底怎么才能做好数据治理呢?
- What do you mean by waiting for insurance records? Where should I go for filing?
- Linux (centos7.9) installation and deployment of MySQL Cluster 7.6
- Redis实现全局唯一ID
- eBanb B1手环刷固件异常中断处理
- cookie加密 4 rpc方法确定cookie加密
- L01_一条SQL查询语句是如何执行的?
猜你喜欢

Easyexcel single sheet and multi sheet writing

When programmers are asked if they can repair computers... | daily anecdotes

PhpStrom代码格式化设置

CF566E-Restoring Map【bitset】

学习太极创客 — ESP8226 (十二)ESP8266 多任务处理

【LeetCode】541. Reverse string II

十二、所有功能实现效果演示

Digital cloud released the 2022 white paper on digital operation of global consumers in the beauty industry: global growth solves marketing problems

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

嵌入式 | 硬件转软件的几条建议
随机推荐
Zero foundation self-study SQL course | having clause
零基础自学SQL课程 | SQL语句语法顺序与执行顺序
The list of open source summer winners has been publicized, and the field of basic software has become a hot application this year
P6117-[JOI 2019 Final]コイン集め【贪心】
可直接套用的Go编码规范
【LeetCode】541. Reverse string II
[use picgo+ Tencent cloud object to store cos as a map bed]
Redis实现全局唯一ID
CF566E-Restoring Map【bitset】
MYCAT read / write separation and MySQL master-slave synchronization
2022.06.23 (traversal of lc_144,94145\
牛客网 十进制整数转十六进制字符串
jupyter入门常见的几个坑:
Digital cloud released the 2022 white paper on digital operation of global consumers in the beauty industry: global growth solves marketing problems
eBanb B1手环刷固件异常中断处理
Zero foundation self-study SQL course | syntax sequence and execution sequence of SQL statements
leetcode--字符串
Leetcode -- linked list
ThinkPHP 5.0 模型关联详解
Weekly recommended short video: is the ultimate form of computing "meta universe"?