zoukankan      html  css  js  c++  java
  • poj2503

    小试探

    #include <stdio.h>
    #include<string.h>
    struct word
    {
    char a[20],b[20];
    }w[100005];
    int main(int argc, char *argv[])
    {
    int len=0;
    char s[100],x[20],y[20];
    int i;
    while(gets(s) && s[0]!=' ')
    {
    sscanf(s,"%s%s",x,y);
    strcpy(w[len].a,x);
    strcpy(w[len].b,y);
    len++;
    }
    for(i=0;i<len-1;i++)



    printf("%s %s ",w[i].a,w[i].b);



    return 0;
    }

     

     ************************************************************************************

    #include <iostream>
    #include <string>
    #include <map>
    using namespace std;

    char s[100],s1[100],s2[100];
    map <string,string> my;
    map <string,string> ::iterator it;

    int main(int argc, char *argv[])

    int i;
     while (gets(s))
     {

     if (strcmp(s,"")==0) break;
      sscanf(s,"%s%s",s1,s2);
      my[s2]=s1;
     }
     while (scanf("%s",s)!=EOF)
     { 

    it=my.find(s);
      if ( it!=my.end()) cout<<my[s]<<endl; 

          else               cout<<"eh ";
     }      
     return 0;
    }

    #include <iostream>
    #include <string>
    #include <cstring>
    #include <cstdio>
    #include <map>
    using namespace std;
    map<string,string> my;
    map<string,string> ::iterator it;

    int main()
    {
    int i,k,ky;
    char cc[50],s1[50],s2[50],s3[50];
    while(gets(cc))
    {
    if(strcmp(cc,"")==0) break;
    sscanf(cc,"%s%s",s1,s2);
    my[s2]=s1;
    }
    while(scanf("%s",s3)!=EOF)
    { it=my.find(s3);
    if(it!=my.end()) cout<<my[s3]<<endl; else cout<<"eh"<<endl;
    }

    }

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<algorithm>
    #include<map>
    using namespace std;
    map<string,string> x;
    int main()
    {
    int i,j;
    char s[100];
    char a[100],b[100];
    while(gets(s),strlen(s))
    {
    sscanf(s,"%s%s",a,b);
    x[b]=a;
    }
    while(cin>>s)
    {
    if(x[s].size())
    cout<<x[s]<<endl;
    else
    cout<<"eh ";
    }
    }

  • 相关阅读:
    bzoj4196: [Noi2015]软件包管理器
    bzoj3083: 遥远的国度
    bzoj4034: [HAOI2015]T2
    2.EXIT_KEY
    AD如何1比1打印
    编程时注意,
    同步事件、异步事件、轮询
    事件位
    挂起进程相关API
    PROCESS_EVENT_POLL事件
  • 原文地址:https://www.cnblogs.com/2014acm/p/3902556.html
Copyright © 2011-2022 走看看