社区讨论
AC了一个测试点还是0分
灌水区参与者 6已保存回复 16
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 16 条
- 当前快照
- 1 份
- 快照标识符
- @lz6u1yyt
- 此快照首次捕获于
- 2024/07/29 18:15 2 年前
- 此快照最后确认于
- 2024/07/29 19:47 2 年前
我也不知道这个算不算一个测试点
file:///C:/Users/tx-chariot/Desktop/%E5%B1%8F%E5%B9%95%E6%88%AA%E5%9B%BE%202024-07-29%20172611.jpg
P1307
CPP#include<bits/stdc++.h>
using namespace std;
int mcf(int q, int cf){
for(int i=1;i<=cf-1;++i){
q = 10 * q;
}
return q;
}
int fz(int a){
int s,m;
const int N = 1e7;
int arr[N];
int sum=0;
for(int i=1;;++i){
s=a%10;
arr[i] = s;
sum++;
if(a<10){
break;
}else{
a=(a-s)/10;
}
}
int uu=0,mm=0;
long long ans=0;
for(int i=sum;i>=0;--i){
uu++;
mm=i;
if(arr[i] == 0){
uu++;
mm--;
ans = ans + mcf(arr[uu], mm);
}
}
return ans;
}
int main(){
int n;
cin>>n;
// cout<<mcf(3, 3);
// cout<<" 1"<<fz(123);
if(n<0){
cout<<"-"<<fz(n);
}else if(n>0){
cout<<fz(n);
}else{
cout<<0;
}
return 0;
}
回复
共 16 条回复,欢迎继续交流。
正在加载回复...