1049

来源:互联网 发布:淘宝网注册账号 编辑:程序博客网 时间:2024/06/05 15:13
#include <iostream>using namespace std;int a[11];int find1(const int& n){int c=0;int cc = n;while(cc>0){a[c++]=cc%10;cc/=10;}int count=0;int temp=1;for(int i=0;i<c;i++){count+=(n/(10*temp))*temp;if(a[i]==1)count+=((n%temp)+1);else if(a[i]>1)count+=temp;temp*=10;}return count;}int main(){int n;cin>>n;cout<<find1(n)<<endl;return 0;}

原创粉丝点击