• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            USACO chapter 2 section 2 Party Lamps

            USER: tian tianbing [tbbd4261]
            TASK: lamps
            LANG: C++
            Compiling...
            Compile: OK
            Executing...
            Test 1: TEST OK [0.011 secs, 3020 KB]
            Test 2: TEST OK [0.000 secs, 3020 KB]
            Test 3: TEST OK [0.000 secs, 3020 KB]
            Test 4: TEST OK [0.011 secs, 3020 KB]
            Test 5: TEST OK [0.000 secs, 3020 KB]
            Test 6: TEST OK [0.000 secs, 3020 KB]
            Test 7: TEST OK [0.011 secs, 3020 KB]
            Test 8: TEST OK [0.011 secs, 3020 KB]
            All tests OK.
            

            Your program ('lamps') produced all correct answers! This is your submission #4 for this problem. Congratulations!

            Here are the test data inputs:

            ------- test 1 -------
            10
            0
            -1
            -1
            ------- test 2 -------
            10
            0
            -1
            1 -1
            ------- test 3 -------
            20
            3
            -1
            1 3 5 -1
            ------- test 4 -------
            50
            100
            1 -1
            -1
            ------- test 5 -------
            75
            250
            -1
            -1
            ------- test 6 -------
            100
            8394
            1 7 13 19 25 31 37 43 49 55 -1
            64 -1
            ------- test 7 -------
            100
            2000
            31 86 23 -1
            42 -1
            ------- test 8 -------
            100
            8950
            -1
            -1
            
            Keep up the good work!
            
            

            Thanks for your submission!
            注意條件:
            if( c>=(i1+i2+i3+i4)&&(c-(i1+i2+i3+i4))%2==0 )……

            /*
            ID:tbbd4261
            PROG:lamps
            LANG:C++
            */

            #include
            <fstream>
            #include
            <iostream>
            #include
            <string>
            #include
            <algorithm>
            #include
            <vector>
            using namespace std;
            ifstream fin(
            "lamps.in");
            ofstream fout(
            "lamps.out");
            int n,c,t;
            bool f[101];
            bool g[101];
            int last[101];

            bool judge()
            {
                 
            for(int i=1; i<=n; i++)
                         
            if(last[i]!=-1&&last[i]!=g[i])
                          
            return false;
                 
            return true;
            }

            void turn1()
            {
                 
            for(int i=1; i<=n; i++)
                       g[i]
            =!g[i];
            }

            void turn2()
            {
                 
            for(int i=1; i<=n; i+=2)
                      g[i]
            =!g[i];
            }

            void turn3()
            {
                 
            for(int i=2; i<=n;i+=2)
                         g[i]
            =!g[i];
            }

            void turn4()
            {
                 
                 
            for(int i=0,k=1; k<=n;)
                 {
                       g[k]
            =!g[k];
                       i
            ++;
                       k
            =3*i+1;
                 }
            }

            int main()
            {
                fin
            >>n;
                fin
            >>c;
                vector
            <string> vec;
                
            string s;
                fill_n(f,
            sizeof f,1);
                fill_n(last,
            sizeof last, -1);
                
            while(fin>>t,t!=-1)last[t]=1;
                
            while(fin>>t,t!=-1)last[t]=0;
                
            int i1, i2, i3, i4,i;
                
            for(i1=0; i1<=1; i1++)
                
            for(i2=0; i2<=1; i2++)
                
            for(i3=0; i3<=1; i3++)
                
            for(i4=0; i4<=1; i4++){
                          
            if( c>=(i1+i2+i3+i4)&&(c-(i1+i2+i3+i4))%2==0 ){
                                  
            for(i=1; i<=n;i++)
                                          g[i]
            =f[i];
                                  
            if(i1)turn1();
                                  
            if(i2)turn2();
                                  
            if(i3)turn3();
                                  
            if(i4)turn4();
                                  
                                  
            if(judge()){
                                       
            for(s="",i=1; i<=n; i++)
                                             s
            +='0'+g[i];
                                       vec.push_back(s);
                                  }
                          }
                }
                
                sort(vec.begin(),vec.end());
                
            if(vec.size()==0)fout<<"IMPOSSIBLE"<<endl;
                
            else{
                   
            for(i=0; i<vec.size(); i++)
                            fout
            <<vec[i]<<endl;
                   }               
                
            return 0;
            }

            posted on 2010-08-01 21:37 田兵 閱讀(155) 評論(0)  編輯 收藏 引用 所屬分類: USACO

            <2010年8月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            2930311234

            導航

            統計

            常用鏈接

            留言簿(2)

            隨筆分類(65)

            隨筆檔案(65)

            文章檔案(2)

            ACM

            搜索

            積分與排名

            最新隨筆

            最新評論

            閱讀排行榜

            免费国产99久久久香蕉| 久久精品女人天堂AV麻| 久久99热这里只有精品国产| 久久九九久精品国产| 久久人人爽人人爽AV片| 国产免费久久久久久无码| 亚洲人成网站999久久久综合 | 狠狠色综合网站久久久久久久| 久久人妻少妇嫩草AV无码蜜桃| 一本色道久久88精品综合| 9久久9久久精品| 久久夜色精品国产噜噜亚洲a| 日韩精品久久无码人妻中文字幕| 青青青青久久精品国产| 亚洲精品无码久久不卡| 久久精品国产清高在天天线| 久久成人国产精品免费软件| 久久久精品久久久久久| 久久精品国产亚洲77777| 波多野结衣久久精品| 久久久久亚洲精品天堂久久久久久 | 精品久久综合1区2区3区激情| 午夜精品久久久久久毛片| 久久久午夜精品福利内容| 一本大道久久a久久精品综合| 国产麻豆精品久久一二三| 欧美大香线蕉线伊人久久| 亚洲第一永久AV网站久久精品男人的天堂AV| 国产精品免费久久久久电影网| 欧洲人妻丰满av无码久久不卡| 亚洲伊人久久综合中文成人网| 国产精品日韩欧美久久综合| 久久精品国产亚洲一区二区| 久久国产精品久久精品国产| 精品久久久久久国产潘金莲| 亚洲中文久久精品无码ww16| 性色欲网站人妻丰满中文久久不卡| 久久受www免费人成_看片中文| 亚洲精品无码久久毛片| 久久中文字幕人妻丝袜| 国产毛片欧美毛片久久久|