
https://codeforces.com/problemset/problem/282/A
#include<bits/stdc++.h>
using namespace std;
int t;
string s;
int ans;
int main(void)
{
cin>>t;
while(t--)
{
cin>>s;
if(s.find("+")!=-1) ans++;
else ans--;
}
cout<<ans;
return 0;
}
该博客展示了一段C++代码,用于解决Codeforces上的问题282A。代码主要检查输入字符串中+和-字符的出现次数,输出它们的差值作为结果。

https://codeforces.com/problemset/problem/282/A
#include<bits/stdc++.h>
using namespace std;
int t;
string s;
int ans;
int main(void)
{
cin>>t;
while(t--)
{
cin>>s;
if(s.find("+")!=-1) ans++;
else ans--;
}
cout<<ans;
return 0;
}

被折叠的 条评论
为什么被折叠?