+
1 2 12
1 10 12

: ++

  1. #1
    Vadya       Vadya
    27.02.2007
    164
    ()
    0
    : 0 (: 0).

    Thumbs up ++

    , ! , :

    1

    //------------------------------------------------- 1
    void F1(char c[])
    { int i,j;
    for (i=0; c[i] !='\0'; i++);
    for (j=0,i--; i>j; i--,j++)
    { char s; s=c[i]; c[i]=c[j]; c[j]=s; }
    }

    //------------------------------------------------- 2
    int F2(char s)
    { if (s >='0' && s <='9') return(s - '0');
    else return(-1); }


    //------------------------------------------------- 3
    void F3(char c[])
    { int i;
    for (i=0; c[i] !='\0'; i++)
    if (c[i] >='a' && c[i] <='z')
    c[i] += 'A' - 'a';
    }

    //------------------------------------------------- 4
    int F4(char c[])
    { int i,old,nw;
    for (i=0, old=0, nw=0; c[i] !='\0'; i++)
    {
    if (c[i]==' ') old = 0;
    else { if (old==0) nw++; old=1; }
    }
    return nw; }

    //------------------------------------------------- 5
    void F5(char c[])
    { int i,j;
    for (i=0, j=0; c[i] !='\0'; i++)
    if (c[i] !=' ') c[j++] = c[i];
    c[j] = '\0';
    }


    //------------------------------------------------- 6
    void F6(char c[], int nn)
    { int k,mm;
    for (mm=nn, k=1; mm !=0; mm /=10,k++);
    for (c[k--]='\0'; k>=0; k--)
    { c[k]= nn % 10 + '0'; nn /=10; }
    }
    //------------------------------------------------- 7
    int F7(char c[])
    { int i,s;
    for (i=0; c[i] !='\0'; i++)
    if (c[i] >='0' && c[i]<='7') break;
    for (s=0; c[i] >='0' && c[i] <='7'; i++)
    s = s * 8 + c[i] - '0';
    return s; }
    //------------------------------------------------- 8
    int F8(char c[])
    { int n,k,ns;
    for (n=0,ns=0; c[n] !='\0'; n++)
    {
    for (k=0; n-k !=0 && c[n+k] !='\0'; k++)
    if (c[n-k] != c[n+k]) break;
    if (k >=3) ns++;
    }
    return ns; }
    //------------------------------------------------- 9
    int F9(char c1[],char c2[])
    { int i,j;
    for (i=0; c1[i] !='\0'; i++)
    {
    for (j=0; c2[j] !='\0'; j++)
    if (c1[i+j] != c2[j]) break;
    if (c2[j] =='\0') return i;
    }
    return -1;}
    //------------------------------------------------ 10
    char F10(char c[])
    { char m,z; int n,s,i;
    for (s=0,m='A'; m <='Z'; m++)
    {
    for (n=0, i=0; c[i] !='\0'; i++)
    if (c[i]==m) n++;
    if (n > s) { z=m; s=n; }
    }
    return z; }
    //------------------------------------------------ 11
    void F11(char c[], double x)
    { int i;
    for (c[0]='.',i=1; i<6; i++)
    {
    x *= 10.; c[i]=(int)x + '0'; x -= (int)x;
    }
    c[i]='\0'; }
    //------------------------------------------------ 12
    int F12(char c[])
    {
    for (int i=0; c[i]!=0; i++)
    {
    if (c[i]==' ') continue;
    for (int j=i+1; c[j]==c[i]; j++);
    for (; c[j]!=0; j++)
    {
    for (int k=0; i+k<j && c[i+k]==c[j+k]; k++);
    if (k>=4) return i;
    }
    }
    }

    //--------------------------------------------------

    2

    .
    //------------------------------------------------- 1
    void F1(int in[],int n)
    { int i,j,k,c;
    for (i=1; i<n; i++)
    { for (k=i; k !=0; k--)
    { if (in[k] > in[k-1]) break;
    c=in[k]; in[k]=in[k-1]; in[k-1]=c;
    }
    } }
    //------------------------------------------------- 2
    void F2(int in[],int out[],int n)
    { int i,j,cnt;
    for (i=0; i<n; i++)
    {
    for (cnt=0,j=0; j<n; j++)
    if (in[j] > in[i]) cnt++;
    else
    if (in[j]==in[i] && j>i) cnt++;
    out[cnt]=in[i];
    }}
    //------------------------------------------------- 3
    void F3(int in[],int n)
    { int a,b,dd,i,lasta,lastb,swap;
    for (a=lasta=0, b=lastb=n, dd=1; a < b;
    dd = !dd, a=lasta, b=lastb)
    {
    if (dd)
    {
    for (i=a,lastb=a; i<b; i++)
    if (in[i] > in[i+1])
    { lastb = i;
    swap = in[i]; in[i]=in[i+1]; in[i+1]=swap;
    }
    }
    else
    {
    for (i=b,lasta=b; i>a; i--)
    if (in[i-1] > in[i])
    { lasta = i;
    swap = in[i]; in[i]=in[i-1]; in[i-1]=swap;
    } } } }
    //------------------------------------------------- 4
    int find(int out[],int n, int val);
    // val
    // out[n]
    void F4(in,n)
    int in[],n;
    {
    int i,j,k;
    for (i=1; i<n; i++)
    { int c; c = in[i]; k = find(in,i,c);
    for (j=i; j!=k; j--) in[j] = in[j-1];
    in[k] = c; }
    }
    //------------------------------------------------- 5
    void F5(int in[], int n)
    { int i,j,c,k;
    for (i=0; i < n-1; i++)
    {
    for (j=i+1,c=in[i],k=i; j<n; j++)
    if (in[j] > c) { c = in[j]; k=j; }
    in[k] = in[i]; in[i] = c;
    } }
    //------------------------------------------------- 6
    #define MAXINT 0x7FFF
    void F6(int in[], int n, int v0[], int v1[])
    {
    int m,i,max,i0,i1;
    for (i=0, max=0; i<n; i++)
    if (in[i] > max) max=in[i];
    for (m=1; m <=max; m <<=1);
    for (m >>=1; m !=0; m >>=1)
    {
    for (i0=i1=0; i0+i1 < n; )
    if ((in[i0+i1] & m) ==0)
    v0[i0] = in[i0+i1], i0++;
    else
    v1[i1] = in[i0+i1], i1++;
    v0[i0] = v1[i1] = MAXINT;
    for (i0=i1=0; i0+i1 < n; )
    if (v0[i0] < v1[i1])
    in[i0+i1] = v0[i0], i0++;
    else
    in[i0+i1] = v1[i1], i1++;
    }
    }
    //--------------------------------------------------7
    void F7(int A[], int n)
    {
    int i,found;
    do { found =0;
    for (i=0; i<n-1; i++)
    if (A[i] > A[i+1])
    { int cc; cc = A[i]; A[i]=A[i+1]; A[i+1]=cc;
    found++;
    }
    } while(found !=0);
    }
    //--------------------------------------------------8
    void sort(int a[], int n)
    {... ...}
    int A[100], B[10][10];
    void F8()
    {
    int i,j;
    for (i=0; i<100; i++) B[i/10][i%10]=A[i];
    for (i=0; i<10; i++) sort(B[i],10);
    for (i=0; i<100; i++)
    {
    int k;
    for (k=0, j=0; j<10; j++)
    if (B[j][0] < B[k][0]) k=j;
    A[i] = B[k][0];
    for (j=1; j<10; j++) B[k][j-1]=B[k][j];
    B[k][9]=MAX_INT;
    }
    }
    //--------------------------------------------------9
    void F9(int in[], int a, int b)
    {
    int i,j,mode;
    if (a>=b) return;
    for (i=a, j=b, mode=1; i < j; mode >0 ? j-- : i++)
    if (in[i] > in[j])
    {
    int c;
    c = in[i]; in[i] = in[j]; in[j]=c;
    mode = -mode;
    }
    sort10(in,a,i-1); sort10(in,i+1,b);
    }
    //--------------------------------------------------10
    void F10(int A[], int n)
    {
    int i,b,b1;
    for (b=n-1; b!=0; b=b1)
    { b1=0;
    for (i=0; i<b; i++)
    if (A[i] > A[i+1])
    { int cc; cc = A[i]; A[i]=A[i+1]; A[i+1]=cc;
    b1=i;
    }
    }
    }
    //--------------------------------------------------11
    void F11(int A[], int B1[], int B2[], int n)
    {
    int i,i1,i2,s,a1,a2,a,k;
    for (s=1; s!=n; s*=2)
    {
    for (i=0; i<n/2; i++)
    { B1[i]=A[i]; B2[i]=A[i+n/2]; }
    i1=i2=0; a1=a2=MAXINT;
    for (i=0,k=0; i<n; i++)
    {
    if (a1==MAXINT && a2==MAXINT && i1==s && i2==s)
    k+=s,i1=0,i2=0;
    if (a1==MAXINT && i1!=s) a1=B1[k+i1],i1++;
    if (a2==MAXINT && i2!=s) a2=B2[k+i2],i2++;
    if (a1<a2)a=a1,a1=MAXINT;
    else a=a2,a2=MAXINT;
    A[i]=a;
    }}}

  2. #2
    Allex       Allex
    28.05.2007
    1,433
    ()
    1
    : 0 (: 0).

    , ...

  3. #3
    qq Kryonn       Kryonn
    03.01.2007
    localhost
    22
    ()
    0
    : 0 (: 0).

    ?)

    44
    )

  4. #4
    Web DemoS       DemoS
    22.02.2007
    476
    ()
    0
    : 0 (: 0).

    Vadya, ? , 1 ...

    , , ...
    DemoS; 04.06.2007 23:49.

  5. #5
    borpas       borpas
    18.09.2006
    133
    ()
    0
    : 0 (: 0).

    Vadya, ... , , !

  6. #6
    piska       piska
    28.03.2007
    66
    ()
    0
    : 0 (: 0).

    !

  7. #7
    Vadya       Vadya
    27.02.2007
    164
    ()
    0
    : 0 (: 0).

    DemoS
    Vadya, ?
    ) 3-
    borpas
    , ,
    , , .. ,

    HPh_Grom
    - !


    Kryonn
    ?)

    44
    )
    ...

    , , . - , )
    Vadya; 05.06.2007 02:46.

  8. #8
    Provad       Provad
    22.10.2008
    30
    435
    ()
    0
    : 0 (: 0).

    __
    ,

  9. #9
    GURO Triller DJerman    DJerman
    08.04.2007
    1,313
    ()
    0
    : 0 (: 0).

    , XD ,

  10. #10
    Iron32       Iron32
    16.05.2008
    ,
    442
    ()
    0
    : 0 (: 0).

    HTML , SS