QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#797967#9578. 爱上字典YuiWA 0ms3792kbC++17700b2024-12-03 22:01:132024-12-03 22:01:14

Judging History

你现在查看的是最新测评结果

  • [2024-12-03 22:01:14]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3792kb
  • [2024-12-03 22:01:13]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10;

using ll = long long;

void solve() {
  string s;
  getline(cin,s);
  int n;cin>>n;
  map<string,int>mp;
  for(int i=0;i<n;i++){
  	string temp;
  	cin>>temp;
  	mp[temp]++;
  }
  string b;
  int ans=0;
  for(int i=0;i<s.size();i++){
  	if(s[i]!=','&&s[i]!='.'&&s[i]!='!'&&s[i]!='?'&&s[i]!=' '){
  		if(s[i]>='A'&&s[i]<='Z'){
  			b+=(s[i]+32);	
  		}
  		else b+=s[i];
  	}
  	else{
  		if(b.size()==0)continue;
  		//cout<<b<<endl;
  		if(mp[b]==0)ans++;
  		b.clear();
  	}
  }
  cout<<ans<<endl;
}

int main() {
  int _=1;
  //cin >> _;
  while (_--) {
    solve();
  }
  return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3596kb

input:

I love Liaoning. Love Dalian!
1
love

output:

3

result:

ok single line: '3'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3792kb

input:

Sulfox Loves Furry! Fur fur Furred.
2
anthropomorphic furry

output:

5

result:

wrong answer 1st lines differ - expected: '4', found: '5'