为什么错了
查看原帖
为什么错了
222057
joy2010WonderMaker楼主2021/1/20 20:10
#include<cstdio>
#include<iostream>
using namespace std;
int main(){
    string a[100];
    int temp=0,ans=0;
    string b;
    for(int i=0;i<100;i++){
        while(scanf("%s",&a[i])!=EOF){
            if(a[i][0]=='+'){
                temp++;
            }else if(a[i][0]=='-'){
                temp--;
            }else{
                for(int j=0;j<a[i].size();j++){
                    if(j==':'){
                        ans=(ans+a[i].size()-j-1)*temp;
                    }
                }
            }
        }
    }
    printf("%d",ans);
    return 0;
}

求大佬指点

2021/1/20 20:10
加载中...