QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#772892#3385. Angry Grammar NaziI_be_wannaAC ✓0ms3848kbC++111.1kb2024-11-22 22:40:432024-11-22 22:40:43

Judging History

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

  • [2024-11-22 22:40:43]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3848kb
  • [2024-11-22 22:40:43]
  • 提交

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