-- 魔咒词典 --

-- 魔咒词典 --_第1张图片

Sample Input
[expelliarmus] the disarming charm
[rictusempra] send a jet of silver light to hit the enemy
[tarantallegra] control the movement of one's legs
[serpensortia] shoot a snake out of the end of one's wand
[lumos] light the wand
[obliviate] the memory charm
[expecto patronum] send a Patronus to the dementors
[accio] the summoning charm
@END@
4
[lumos]
the summoning charm
[arha]
take me to the sky
Sample Output
light the wand
accio
what?
what?
本来以为可以用string和map做的题,结果到头来发现根本行不通,因为给的内存限制太小,做完就会出现

Memory Limit Exceeded

所以改用直接用strcmp查找,稳过

#include
#include
#include
#include 
#include 
#include 
#include 
#include 
#include
#include 
#include
#include
using namespace std;
struct same
{
    char a[100];
    char b[100];
} q[100003];
int main()
{
    int i=0;
    char c[6]="@END@";
    while(scanf("%s",q[i].a))
    {
        getchar();
        if(strcmp(q[i].a,c)==0)
            break;
        gets(q[i++].b);
    }
    int n;
    scanf("%d",&n);
    getchar();
    while(n--)
    {
        char str[100];
        gets(str);
        int m=-1;
        if(str[0]=='[')
        {
            for(int j=0; j

你可能感兴趣的:(-- 魔咒词典 --)