题解 | 小苯的计算式

小苯的计算式

https://www.nowcoder.com/practice/df8990666dea4634a9b746cda5226f00

//暴力
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
signed main()
{
    int n,c;
    cin>>n>>c;
    int ans=0;
    int clen=to_string(c).size();
    for(int i=0;i<=c;i++){
        int a=i;
        int b=c-i;
        int alen=to_string(a).size();
        int blen=to_string(b).size();
        if(alen+blen+2+clen==n) ans++;
    }
    cout<<ans<<endl;
   return 0;
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务