Differences between revisions 89 and 125 (spanning 36 versions)
Revision 89 as of 2004-12-23 09:00:04
Size: 10066
Editor: 66
Comment:
Revision 125 as of 2005-04-02 06:33:57
Size: 1627
Editor: lihan
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
##language:zh
#pragma section-numbers off
{{{
#!cplusplus
Line 4: Line 4:
'''
巧夺天工的设计,就在自然之间
'''
[[TableOfContents]]

||<^60%>[[Include(WoodpeckerOrg)]]||[[Include(DiscoverOnline)]]||
#include<stdio.h>
#include<string.h>
typedef struct
{ char ch[50];
   int len;
}SqString;
int creat_string(SqString s1,SqString s2,SqString s);
int check(int a[50][50]);
Line 12: Line 14:
----
ZoomQuiet [[DateTime(2004-08-09T21:42:16Z)]]
void main()
{ int i=0;
   SqString s,s1,s2;
   scanf("%s",&s1.ch);
   s1.len=strlen(s1.ch);
   scanf("%s",&s2.ch);
   s2.len=strlen(s2.ch);
   for(i=0;i<10;i++){
Line 15: Line 23:
   s.ch[i]='*';
 s.len++;
   }
   creat_string(s1,s2,s);
   return ;
}
int creat_string(SqString s1,SqString s2,SqString &s)
{ int i,j,k,m,n,t=0;
   int a[50][50];
   int b[50][50];
   for(i=0;i<50;i++)
    for(j=0;j<50;j++)
           a[i][j]=b[i][j]=0;
   for(i=0;i<s1.len;i++)
    for(j=0;j<s2.len;j++)
     if(s1.ch[i]==s2.ch[j])
      a[i][j]=1;
   k=1;
   while(check(a))
   {
   for(i=0;i<s1.len;i++)
        for(j=0;j<s2.len;j++)
  {
        b[i][j]=a[i][j];
  }
   for(m=0;m<s1.len;m++)
   { while(i<s1.len&&j<s2.len)
   { if(a[i][j]==1&&a[i+k][j+k]==0)
   { a[i][j]=0;
             i=i+k+1;
    j=j+k+1;
   }
         else
   {i++;
    j++;
   }
   }
   }
   for(n=0;n<s2.len;n++)
   { while(i<s1.len&&j<s2.len)
   { if(a[i][j]==1&&a[i+k][j+k]==0)
   { a[i][j]=0;
             i=i+k+1;
    j=j+k+1;
   }
         else
   {i++;
    j++;
   }
   }
   }
   k++;
 }
 while(i<s1.len&&j<s2.len)
   if(b[i][j]==1)
    for(;t<k;t++)
    { s.ch[t]=s1.ch[i];
      i++;
    }
 printf("%s",s.ch);
 return 1;
}
int check(int a[50][50])
{ int i,j;
  for(i=0;i<50;i++)
        for(j=0;j<50;j++)
   if(a[i][j]!=0)
    return 1;
  return 0;
}
Line 16: Line 94:

[http://save-on-abilify.fateback.com/ Abilify] [http://save-on-acarbose.yoll.net/ Acarbose] [http://save-on-achromycin.imess.net/ Achromycin] [http://save-on-aciphex.deep-ice.com/ Aciphex] [http://save-on-actos.undonet.com/ Actos] [http://save-on-acyclovir.bebto.com/ Acyclovir] [http://save-on-adalat.noneto.com/ Adalat] [http://save-on-adapalene.enacre.net/ Adapalene] [http://save-on-advair-diskus-inhaler.my-age.net/ Advair Diskus Inhaler] [http://save-on-albuterol.hotusa.org/ Albuterol] [http://save-on-alendronate.sinfree.net/ Alendronate] [http://save-on-allegra.fateback.com/ Allegra] [http://save-on-allegra-d.yoll.net/ ALLEGRA D] [http://save-on-allopurinol.imess.net/ Allopurinol] [http://save-on-altace.deep-ice.com/ Altace] [http://save-on-amitriptyline.undonet.com/ Amitriptyline] [http://save-on-amlodipine.bebto.com/ Amlodipine] [http://save-on-amlodipine-besylate.noneto.com/ Amlodipine Besylate] [http://save-on-amoxil.enacre.net/ Amoxil] [http://save-on-ampicillin.my-age.net/ Ampicillin] [http://save-on-ansaid.hotusa.org/ Ansaid] [http://save-on-arava.sinfree.net/ Arava] [http://save-on-atenolol.fateback.com/ Atenolol] [http://save-on-atorvastatin.yoll.net/ Atorvastatin] [http://save-on-avandia.imess.net/ Avandia] [http://save-on-azithromycin.deep-ice.com/ Azithromycin] [http://save-on-bactrim.undonet.com/ Bactrim] [http://save-on-bactroban.bebto.com/ Bactroban] [http://save-on-bextra.noneto.com/ Bextra] [http://save-on-biaxin.enacre.net/ Biaxin] [http://save-on-calan.my-age.net/ Calan] [http://save-on-cardura.hotusa.org/ Cardura] [http://save-on-carisoprodol.sinfree.net/ Carisoprodol] [http://save-on-carvedilol.fateback.com/ Carvedilol] [http://save-on-ceclor.yoll.net/ Ceclor] [http://save-on-celebrex.imess.net/ Celebrex] [http://save-on-celecoxib.deep-ice.com/ Celecoxib] [http://save-on-celexa.undonet.com/ Celexa] [http://save-on-cephalexin.bebto.com/ Cephalexin] [http://save-on-cialis.noneto.com/ Cialis] [http://save-on-cilostazol.enacre.net/ Cilostazol] [http://save-on-cimetidine.my-age.net/ Cimetidine] [http://save-on-cipro.hotusa.org/ Cipro] [http://save-on-ciprofloxacin.sinfree.net/ Ciprofloxacin] [http://save-on-cisapride.fateback.com/ Cisapride] [http://save-on-clarinex.yoll.net/ Clarinex] [http://save-on-claritin.imess.net/ Claritin] [http://save-on-cleocin.deep-ice.com/ Cleocin] [http://save-on-clindamycin.undonet.com/ Clindamycin] [http://save-on-clobetasol.bebto.com/ Clobetasol] [http://save-on-clomid.noneto.com/ Clomid] [http://save-on-clotrimazole.enacre.net/ Clotrimazole] [http://save-on-coumadin.my-age.net/ Coumadin] [http://save-on-cozaar.hotusa.org/ Cozaar] [http://save-on-cutivate.sinfree.net/ Cutivate] [http://save-on-cycrin.fateback.com/ Cycrin] [http://save-on-cytotec.yoll.net/ Cytotec] [http://save-on-danozol.imess.net/ Danozol] [http://save-on-desyrel.deep-ice.com/ Desyrel] [http://save-on-diclofenac.undonet.com/ Diclofenac] [http://save-on-differin.bebto.com/ Differin] [http://save-on-diflucan.noneto.com/ Diflucan] [http://save-on-dilantin.enacre.net/ Dilantin] [http://save-on-dimenhydrinate.my-age.net/ Dimenhydrinate] [http://save-on-ditropan.hotusa.org/ Ditropan] [http://save-on-doxycycline.sinfree.net/ Doxycycline] [http://save-on-dramamine.fateback.com/ Dramamine] [http://save-on-effexor.yoll.net/ Effexor] [http://save-on-elocon.imess.net/ Elocon] [http://save-on-enalapril.deep-ice.com/ Enalapril] [http://save-on-erythromycin.undonet.com/ Erythromycin] [http://save-on-esidrex.bebto.com/ Esidrex] [http://save-on-esomeprazole.noneto.com/ Esomeprazole] [http://save-on-estrace.enacre.net/ Estrace] [http://save-on-estradiol.my-age.net/ Estradiol] [http://save-on-evista.hotusa.org/ Evista] [http://save-on-famotidine.sinfree.net/ Famotidine] [http://save-on-feldene.fateback.com/ Feldene] [http://save-on-fexofenadine.yoll.net/ Fexofenadine] [http://save-on-fexofenadine---pseudoephedrine.imess.net/ Fexofenadine + Pseudoephedrine] [http://save-on-finasteride.deep-ice.com/ Finasteride] [http://save-on-flagyl.undonet.com/ Flagyl] [http://save-on-flomax.bebto.com/ FLomax] [http://save-on-flonase.noneto.com/ Flonase] [http://save-on-flovent.enacre.net/ Flovent] [http://save-on-floxin.my-age.net/ Floxin] [http://save-on-fluconazole.hotusa.org/ Fluconazole] [http://save-on-fluoxetine-hydrochloride.sinfree.net/ Fluoxetine Hydrochloride] [http://save-on-flutivate.fateback.com/ Flutivate] [http://save-on-fosamax.yoll.net/ Fosamax] [http://save-on-frusemide.imess.net/ Frusemide] [http://save-on-gemfibrozil.deep-ice.com/ Gemfibrozil] [http://save-on-glibenclamide.undonet.com/ Glibenclamide] [http://save-on-glucophage.bebto.com/ Glucophage] [http://save-on-glucophage-xr.noneto.com/ GLUCOPHAGE XR] [http://save-on-glucotrol.enacre.net/ Glucotrol] [http://save-on-glucovance.my-age.net/ Glucovance] [http://save-on-glyburide.hotusa.org/ Glyburide] [http://save-on-glyburide-metformin-hydrochloride.sinfree.net/ GLYBURIDE+METFORMIN HYDROCHLORIDE] [http://save-on-gravol.fateback.com/ Gravol] [http://save-on-hydrochlorothiazide.yoll.net/ Hydrochlorothiazide] [http://save-on-hytrin.imess.net/ Hytrin] [http://save-on-ilosone.deep-ice.com/ Ilosone] [http://save-on-imitrex.undonet.com/ Imitrex] [http://save-on-inderal.bebto.com/ Inderal] [http://save-on-indocin.noneto.com/ Indocin] [http://save-on-isordil.enacre.net/ Isordil] [http://save-on-isosorbide.my-age.net/ Isosorbide] [http://save-on-itraconazole.hotusa.org/ Itraconazole] [http://save-on-k-dur.sinfree.net/ K-Dur] [http://save-on-keflex.fateback.com/ Keflex] [http://save-on-ketoconazole.yoll.net/ Ketoconazole] [http://save-on-lamisil.imess.net/ Lamisil] [http://save-on-lamisil-cream.deep-ice.com/ Lamisil Cream] [http://save-on-lanoxin.undonet.com/ Lanoxin] [http://save-on-lansoprazole.bebto.com/ Lansoprazole] [http://save-on-lasix.noneto.com/ Lasix] [http://save-on-latanoprost.enacre.net/ Latanoprost] [http://save-on-levaquin.my-age.net/ Levaquin] [http://save-on-levitra.hotusa.org/ Levitra] [http://save-on-levofloxacin.sinfree.net/ Levofloxacin] [http://save-on-levothroid.fateback.com/ Levothroid] [http://save-on-levoxyl.yoll.net/ Levoxyl] [http://save-on-lipitor.imess.net/ Lipitor] [http://save-on-lisinopril.deep-ice.com/ Lisinopril] [http://save-on-lopid.undonet.com/ Lopid] [http://save-on-lopressor.bebto.com/ Lopressor] [http://save-on-loratadine.noneto.com/ Loratadine] [http://save-on-lotensin.enacre.net/ Lotensin] [http://save-on-lotrel.my-age.net/ Lotrel] [http://save-on-lotrel.hotusa.org/ Lotrel] [http://save-on-lotrimin.sinfree.net/ Lotrimin] [http://save-on-macrobit.fateback.com/ Macrobit] [http://save-on-macrodantin.yoll.net/ Macrodantin] [http://save-on-meridia.imess.net/ Meridia] [http://save-on-metformin.deep-ice.com/ Metformin] [http://save-on-metoprolol.undonet.com/ Metoprolol] [http://save-on-metronidazole.bebto.com/ Metronidazole] [http://save-on-miconazole.noneto.com/ Miconazole] [http://save-on-misoprostol.enacre.net/ Misoprostol] [http://save-on-mobic.my-age.net/ Mobic] [http://save-on-moduretic.hotusa.org/ Moduretic] [http://save-on-monistat.sinfree.net/ Monistat] [http://save-on-motrin.fateback.com/ Motrin] [http://save-on-naprosyn.yoll.net/ Naprosyn] [http://save-on-neurontin.imess.net/ Neurontin] [http://save-on-nexium.deep-ice.com/ Nexium] [http://save-on-nimesulide.undonet.com/ Nimesulide] [http://save-on-nizoral.bebto.com/ Nizoral] [http://save-on-nolvadex.noneto.com/ Nolvadex] [http://save-on-norvasc.enacre.net/ Norvasc] [http://save-on-ocuflox.my-age.net/ Ocuflox] [http://save-on-ovral---g.hotusa.org/ Ovral - G] [http://save-on-ovral---l.sinfree.net/ Ovral - L] [http://save-on-oxybutynin.fateback.com/ Oxybutynin] [http://save-on-panadol.yoll.net/ Panadol] [http://save-on-paxil.imess.net/ Paxil] [http://save-on-pepcid.deep-ice.com/ Pepcid] [http://save-on-phenergan.undonet.com/ Phenergan] [http://save-on-pioglitazone.bebto.com/ Pioglitazone] [http://save-on-piroxicam.noneto.com/ Piroxicam] [http://save-on-plavix.enacre.net/ Plavix] [http://save-on-pletal.my-age.net/ Pletal] [http://save-on-pravachol.hotusa.org/ Pravachol] [http://save-on-precose.sinfree.net/ Precose] [http://save-on-prednisolone.fateback.com/ Prednisolone] [http://save-on-premarin.yoll.net/ Premarin] [http://save-on-premphase.imess.net/ Premphase] [http://save-on-premphase-cycle.deep-ice.com/ Premphase Cycle] [http://save-on-prevacid.undonet.com/ Prevacid] [http://save-on-prevacid.bebto.com/ Prevacid] [http://save-on-prilosec.noneto.com/ Prilosec] [http://save-on-promethazine.enacre.net/ Promethazine] [http://save-on-propecia.my-age.net/ Propecia] [http://save-on-propranolol.hotusa.org/ Propranolol] [http://save-on-propranolol.sinfree.net/ Propranolol] [http://save-on-propulsid.fateback.com/ Propulsid] [http://save-on-protonix.yoll.net/ Protonix] [http://save-on-provera.imess.net/ Provera] [http://save-on-prozac.deep-ice.com/ Prozac] [http://save-on-rabeprazole.undonet.com/ Rabeprazole] [http://save-on-ramipril.bebto.com/ Ramipril] [http://save-on-ranitidine.noneto.com/ Ranitidine] [http://save-on-retin-a.enacre.net/ Retin-A] [http://save-on-risperdal.my-age.net/ Risperdal] [http://save-on-rofecoxib.hotusa.org/ Rofecoxib] [http://save-on-sertraline-hcl.sinfree.net/ Sertraline HCL] [http://save-on-sibutramine.fateback.com/ Sibutramine] [http://save-on-sildenafil-citrate.yoll.net/ Sildenafil Citrate] [http://save-on-simvastatin.imess.net/ Simvastatin] [http://save-on-singulair.deep-ice.com/ Singulair] [http://save-on-soma.undonet.com/ Soma] [http://save-on-sporanox.bebto.com/ Sporanox] [http://save-on-synthroid.noneto.com/ Synthroid] [http://save-on-tadalafil.enacre.net/ Tadalafil] [http://save-on-tagamet.my-age.net/ Tagamet] [http://save-on-tamoxifen.hotusa.org/ Tamoxifen] [http://save-on-temovate.sinfree.net/ Temovate] [http://save-on-tenormin.fateback.com/ Tenormin]
...
}}}

Toggle line numbers
   1 #include<stdio.h>
   2 #include<string.h>
   3 typedef struct 
   4 {  char ch[50];
   5    int len;
   6 }SqString;
   7 int creat_string(SqString s1,SqString s2,SqString s);
   8 int check(int a[50][50]);
   9 
  10 
  11 void main()
  12 {  int i=0;
  13    SqString s,s1,s2;
  14    scanf("%s",&s1.ch);
  15    s1.len=strlen(s1.ch); 
  16    scanf("%s",&s2.ch);
  17    s2.len=strlen(s2.ch);
  18    for(i=0;i<10;i++){
  19 
  20    s.ch[i]='*';
  21         s.len++;
  22    }
  23    creat_string(s1,s2,s);
  24    return ;
  25 }
  26 int creat_string(SqString s1,SqString s2,SqString &s)
  27 {  int i,j,k,m,n,t=0;
  28    int a[50][50];
  29    int b[50][50];
  30    for(i=0;i<50;i++)
  31            for(j=0;j<50;j++)
  32            a[i][j]=b[i][j]=0;
  33    for(i=0;i<s1.len;i++)
  34            for(j=0;j<s2.len;j++)
  35                    if(s1.ch[i]==s2.ch[j])
  36                            a[i][j]=1;
  37    k=1;
  38    while(check(a))
  39    {
  40           for(i=0;i<s1.len;i++)
  41         for(j=0;j<s2.len;j++)
  42                 {
  43                b[i][j]=a[i][j];
  44                 }
  45           for(m=0;m<s1.len;m++)
  46           {   while(i<s1.len&&j<s2.len)
  47           {     if(a[i][j]==1&&a[i+k][j+k]==0)
  48           {         a[i][j]=0;
  49                     i=i+k+1;
  50                                 j=j+k+1;
  51           }
  52                 else
  53                         {i++;
  54                          j++;
  55                         }
  56           }
  57           }
  58           for(n=0;n<s2.len;n++)
  59           {   while(i<s1.len&&j<s2.len)
  60           {     if(a[i][j]==1&&a[i+k][j+k]==0)
  61           {         a[i][j]=0;
  62                     i=i+k+1;
  63                                 j=j+k+1;
  64           }
  65                 else
  66                         {i++;
  67                          j++;
  68                         }
  69           }
  70           }
  71           k++;
  72         }
  73         while(i<s1.len&&j<s2.len)
  74                         if(b[i][j]==1)
  75                                 for(;t<k;t++)
  76                                 { s.ch[t]=s1.ch[i];
  77                                   i++;
  78                                 }
  79         printf("%s",s.ch);
  80         return 1;
  81 }
  82 int check(int a[50][50])
  83 { int i,j;
  84   for(i=0;i<50;i++)
  85         for(j=0;j<50;j++)
  86                         if(a[i][j]!=0)
  87                                 return 1;
  88   return 0;
  89 }
  90 
  91 ...

FrontPage2.0 (last edited 2009-12-25 07:17:24 by localhost)