当前位置:网站首页>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;
}
边栏推荐
- Code written by mysql, data addition, deletion, query and modification, etc
- 软件系统依赖关系分析
- Some common pitfalls in getting started with jupyter:
- 支持向量机(SVC,NuSVC,LinearSVC)
- tp5 使用post接收数组数据时报variable type error: array错误的解决方法
- Niuke network decimal integer to hexadecimal string
- Leetcode-- string
- Software system dependency analysis
- Linux MySQL installation
- 零基础自学SQL课程 | SQL语句语法顺序与执行顺序
猜你喜欢

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

Solution: the word of jmeter5.5 on the win11 lower interface is very small

Support vector machine (SVC, nusvc, linearsvc)

Every (), map (), forearch () methods. There are objects in the array

Groovy通过withCredentials获取Jenkins凭据

PhpStrom代码格式化设置

The native applet uses canvas to make posters, which are scaled to the same scale. It is similar to the uniapp, but the writing method is a little different

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

Ebanb B1 Bracelet brush firmware abnormal interrupt handling

L01_ How is an SQL query executed?
随机推荐
从618看京东即时零售的野心
Linux (centos7.9) installation and deployment of MySQL Cluster 7.6
Get post: do you really know the difference between requests??????
Codeforces Round #392 (Div. 2) D. Ability To Convert
Some common pitfalls in getting started with jupyter:
零基础自学SQL课程 | HAVING子句
Thinkphp5清除runtime下的cache缓存,temp缓存,log缓存
读CVPR 2022目标检测论文得到的亿点点启发
Time series data augmentation for deep learning: paper reading of a survey
Software system dependency analysis
LeetCode: 137. 只出现一次的数字 II
目标检测系列——Fast R-CNN
零基础自学SQL课程 | 相关子查询
当程序员被问会不会修电脑时… | 每日趣闻
Zero foundation self-study SQL course | having clause
Epidemic situation, unemployment, 2022, we shouted to lie down!
获取带参数的微信小程序二维码-以及修改二维码LOGO源码分享
【Redis实现秒杀业务①】秒杀流程概述|基本业务实现
How to import MDF and LDF files into MySQL workbench
每周推薦短視頻:談論“元宇宙”要有嚴肅認真的態度