QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#772892 | #3385. Angry Grammar Nazi | I_be_wanna | AC ✓ | 0ms | 3848kb | C++11 | 1.1kb | 2024-11-22 22:40:43 | 2024-11-22 22:40:43 |
Judging History
answer
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <list>
#include <set>
using namespace std;
const int maxn = 1e3+100;
char str[maxn],s[maxn];
int main()
{
int t,len,l,ans,flag;
scanf("%d%*c",&t);
while(t--)
{
gets(str);
len = strlen(str);
str[len] = ' ';
len++;
l = 0;
ans = 0;
flag = 0;
for(int i = 0; i < len; i++)
{
if(str[i] == ' ')
{
s[l] = '\0';//很重要,,标志字符串s结束
if(strcmp(s,"u")==0 || strcmp(s,"ur")==0) ans++;
if(strstr(s,"lol")) ans++;
if(flag && strcmp(s,"of")==0) ans++;
if(strcmp(s,"would")==0 || strcmp(s,"should")==0) flag = 1;
else flag = 0;
l = 0;
}
else s[l++] = str[i];
}
printf("%d\n",ans*10);
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3848kb
input:
50 u haz lolcats my car is green i have a lollipop u should of lold of would should of of should should of trololololololololololololololololololololololololololololololololololololololololololololololololol you have hahacats u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u ...
output:
20 0 10 30 20 10 0 500 0 0 0 0 0 0 0 0 0 10 0 0 10 0 10 10 0 0 10 0 20 40 40 10 0 0 20 0 0 20 0 0 0 20 0 20 10 20 10 10 0 0
result:
ok 50 lines
Extra Test:
score: 0
Extra Test Passed