a5306807's blog

By a5306807, 12 years ago, In English

It is a piece of cake for a master-hand...but I just a new here, even a new in programming. Link:http://mirror.codeforces.com/problemset/problem/112/A

I got an AC only try it once,it seems that I find the right way at first. When I'm face with the 149.A got the WA a whole night...= = The code?I don't know how to put it here...I will try it.... ~~~~~ 1200663 ~~~~~

#include <iostream>
#include <string>
#include <cstdio>

#include <cstring>
using namespace std;
char a1[110];
char a2[110];
char b1[110];
char b2[110];


int Cmp(char *pstr1,char *pstr2)
  {int i,t;
  for(i=0;pstr1[i]!='\0';i++)
  if(pstr1[i]>='A'&&pstr1[i]<='Z')
  *(pstr1+i)=*(pstr1+i)+32;
  for(i=0;pstr2[i]!='\0';i++)
  if(pstr2[i]>='A'&&pstr2[i]<='Z')
  *(pstr2+i)=*(pstr2+i)+32;
  t=0;
  for(i=0;i<strlen(pstr1);i++)
      {if(*(pstr1+i)>*(pstr2+i))
              {t=1;break;}
        if(*(pstr1+i)<*(pstr2+i))
              {t=-1;break;}
      if(*(pstr1+i)>*(pstr2+i))
      continue;      
      
      }
        return t;  
  }
             
             
             
int main()
  {int t;
  gets(a1);
  gets(a2);
  t=Cmp(a1,a2);
  
  if(t==1) cout<<1;
  if(t==-1)cout<<-1;
  if(t==0)cout<<0;     
      cin.get();    
          cout<<endl;
          
return 0;          
}
  • Vote: I like it
  • -20
  • Vote: I do not like it

»
12 years ago, # |
  Vote: I like it +1 Vote: I do not like it
  • »
    »
    12 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Seems like links with Chinese anchor text do not work. That one was to Google Translate.

    • »
      »
      »
      12 years ago, # ^ |
        Vote: I like it +3 Vote: I do not like it

      Why do I have to type my words in English?

      • »
        »
        »
        »
        12 years ago, # ^ |
          Vote: I like it +3 Vote: I do not like it

        The translation on Google is a word-by-word translation, so I considerate that even you can do it successfully you won't be able to understand the translation..

»
12 years ago, # |
  Vote: I like it 0 Vote: I do not like it

原来可以输中文

  • »
    »
    12 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    是啊是啊,试试发现可以

    • »
      »
      »
      12 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      It seems that everyone hates Chinese...

      • »
        »
        »
        »
        12 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        But I don't hope that.

        • »
          »
          »
          »
          »
          12 years ago, # ^ |
          Rev. 2   Vote: I like it 0 Vote: I do not like it

          It seems that it is the regulation..but I wanna say like 1900 in the movie...

          • »
            »
            »
            »
            »
            »
            12 years ago, # ^ |
              Vote: I like it +1 Vote: I do not like it

            I don't know what you mean clearly...

            • »
              »
              »
              »
              »
              »
              »
              12 years ago, # ^ |
                Vote: I like it +1 Vote: I do not like it

              That sentence is:f**k the rules