Results 1 to 10 of 10

Thread:

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User demonskater's Avatar
    Join Date: Sep:2009
    Location: Varna
    Posts: 103

    , . 6 : 1, 1, 1, 1, 1, 1 , 3 .

    , . :

    Code:
    #include <iostream>
    using namespace std;
    
    int main()
    {
    	int a[] = { 1, 1, 1, 1, 1, 1 };
    	int b,c;
    	int br = 0;
    
    	for ( int i = 0; i < sizeof(a); i+=2 )
    	{
    		b = a[i];
    		c = a[i+1];
    		
    		for ( int j = i + 2; j < sizeof(a) - 1; j ++ )
    			if( b == a[j] &&  c == a[j+1] ) br++;
    	}
    
    	cout<< "\n" << br;
    	return 0;
    }
    , .
    , .

  2. #2
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    , if , , br++, j++ .

  3. #3
    Registered User demonskater's Avatar
    Join Date: Sep:2009
    Location: Varna
    Posts: 103
    , ..
    , .

  4. #4
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    6 .
    , "" . { 1,2,1,2,1,1 } , 2 1 . 2.
    br = 1, 0 ( 2 , ).
    if , , i+=2; . ..
    if( b == a[j] && c == a[j+1] ) { br++; j++; i += 2; }

    , - for- while-.

  5. #5
    Registered User demonskater's Avatar
    Join Date: Sep:2009
    Location: Varna
    Posts: 103
    - , , . - 2, { 1, 2, 1, 2, 1, 1 }. , , .
    , .

  6. #6
    ɐ-əpoɔᴉu⋂ ɐ ə anrieff's Avatar
    Join Date: Apr:2004
    Location: Sofia
    Posts: 8,448
    - {1, 2, 1, 2, 1, 1 } 3?
    , . .
    "640K ught to be enough for anybody" - Bill Gates, 1981
    ::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |