题解 | #游游的数字圈#

游游的数字圈

https://www.nowcoder.com/practice/16eafa41a4a242b8870cb2c5420ae089

模拟。

#include<bits/stdc++.h>
#define int long long
#define double long double
#define x first
#define y second
using namespace std;
typedef long long LL;
typedef long long ll;
typedef pair<int,int> PII;
const int N=3e5+10;
const int M=1e3+10;
int mod=1e9+7;
int a[N];
// int cal(string s){
//     int ans=0;
//     for(auto it:s) ans=ans*10+it-'0';
//     return ans;
// }

void solve(){
    map<char,int>mp;
    mp[0]=mp[6]=mp[9]=1;
    mp[8]=2;
    string s;cin>>s;
    int ans=0;
    for(int i=0;i<s.size();i++) ans+=mp[s[i]-'0'];
    cout<<ans<<"\n";
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    int _;
    _=1;
    //cin>>_;
    while(_--){
        solve();
    }
}

全部评论

相关推荐

09-17 10:53
四川大学 C++
牛客91242815...:会写标书没有任何卵用,鉴定为横向垃圾导师的受害者
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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