题解 | #游游的数字圈#

游游的数字圈

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

map映射

#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <numeric>
#include <ctime>
#include <string>
#include <bitset>
#include <unordered_map>
#include <unordered_set>

using namespace std;
using ll = long long;
const ll N=1e6+5,mod=1e9+7,inf=0x3f3f3f3f;


void solve(){
    map<char,int>mp;
    mp['0']=mp['6']=mp['9']=1;
    mp['8']=2;

    string a;
    cin>>a;
    int ans=0;

    for(auto i:a){
        ans+=mp[i];
    }
    cout<<ans<<'\n';
}

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    int t=1;
    //cin>>t;

    while(t--){
        
        solve();

    }
 
    return 0;
}

全部评论

相关推荐

不愿透露姓名的神秘牛友
11-21 11:29
已编辑
斯卡蒂味的鱼汤:知道你不会来数马,就不捞你😂最近数马疯狂扩招,招聘要求挺低的,你能力肯定够,应该就是因为太强了,知道你不会来才不捞你
投递腾讯云智研发等公司7个岗位
点赞 评论 收藏
分享
八极星:有什么不能问的,(/_\),这又不是多珍贵的机会,你有什么可失去的
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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