• <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 3 section 3 Feed Ratios

            USER: tian tianbing [tbbd4261]
            TASK: ratios
            LANG: C++
            Compiling...
            Compile: OK
            Executing...
            Test 1: TEST OK [0.043 secs, 3016 KB]
            Test 2: TEST OK [0.032 secs, 3016 KB]
            Test 3: TEST OK [0.032 secs, 3016 KB]
            Test 4: TEST OK [0.022 secs, 3016 KB]
            Test 5: TEST OK [0.022 secs, 3016 KB]
            Test 6: TEST OK [0.032 secs, 3016 KB]
            All tests OK.
            

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

            Here are the test data inputs:

            ------- test 1 -------
            5 8 0
            3 5 4
            1 3 0
            6 2 0
            ------- test 2 -------
            3 4 5
            1 2 3
            3 7 1
            2 1 2
            ------- test 3 -------
            20 22 24
            4 5 5
            9 5 6
            12 12 14
            ------- test 4 -------
            80 85 80
            98 97 96
            89 87 88
            78 79 80
            ------- test 5 -------
            99 99 99
            1 0 0
            0 1 0
            0 0 1
            ------- test 6 -------
            93 95 97
            98 0 0
            0 98 0
            0 0 98
            
            Keep up the good work!
            
            
            Thanks for your submission!
            直接枚舉就能過了,提交了18次,不知道為什么用fin讀不了,后來還是讓同學幫我改成C的文件讀入才過的
            到現在還是不知道為什么。
            要注意比例和飼料都是非負的小于100的,也就是說可能出現0的情況,要小心。
            /*
            ID:tbbd4261
            PROG:ratios
            LANG:C++
            */

            #include
            <fstream>
            #include 
            <stdio.h>
            using namespace std;
            //fstream fin("ratios.in");
            ofstream fout("ratios.out");

            int main()
            {
                
            int food[4][4];
                freopen(
            "ratios.in","r",stdin);
                freopen(
            "ratios.out","w",stdout);
                
            int i,j,k,minsum=0xffffff,a=0,b=0,c=0,d=0;
                
            for(i=0; i<4; i++)
                    
            for(j=1; j<=3; j++)
                         scanf(
            "%d",&food[i][j]);
                
            int n1,n2,n3;
                
            bool f1,f2,f=false;
                
            for(i=0; i<=100; i++)
                    
            for(j=0; j<=100; j++)
                         
            for(k=0; k<=100; k++){
                                 n1
            =food[1][1]*i+food[2][1]*j+food[3][1]*k;
                                 n2
            =food[1][2]*i+food[2][2]*j+food[3][2]*k;
                                 n3
            =food[1][3]*i+food[2][3]*j+food[3][3]*k;
                        
                             
            int t=0;  f1=false; f2=false;
                             
            if(food[0][1]==0){
                                 f1
            =true;
                                 
            if(n1!=0)continue;
                             }
            else{
                                  
            if(n1%food[0][1]!=0)continue;
                                  t
            =n1/food[0][1];
                             }
                             
                             
            if(food[0][2]==0){
                                  f2
            =true;
                                  
            if(n2!=0)continue;
                             }
            else {
                                   
            if(n2%food[0][2]!=0)continue;
                                   
            if(f1==true)t=n2/food[0][2];
                                   
            else if(n2/food[0][2]!=t)continue;
                             }
                             
                             
            if(food[0][3]==0){
                                   
            if(n3!=0)continue;  
                             }
            else{
                                   
            if(n3%food[0][3]!=0)continue;
                                   
            if(f1&&f2)t=n3/food[0][3];
                                   
            if((f1==false ||f2==false)&&n3/food[0][3]!=t)continue;
                             }
                         
                             
            if( n1+n2+n3<minsum&&(n1||n2||n3)){
                                 f
            =true;
                              minsum
            =n1+n2+n3;  
                              a
            =i; b=j; c=k; d=t; 
                              }
                }
                
            if(f) fout<<a<<' '<<b<<' '<<c<<' '<<d<<endl;
                
            else fout<<"NONE"<<endl;   
                
            return 0;
            }

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

            <2010年6月>
            303112345
            6789101112
            13141516171819
            20212223242526
            27282930123
            45678910

            導航

            統計

            常用鏈接

            留言簿(2)

            隨筆分類(65)

            隨筆檔案(65)

            文章檔案(2)

            ACM

            搜索

            積分與排名

            最新隨筆

            最新評論

            閱讀排行榜

            久久国产精品久久久| 久久精品亚洲AV久久久无码| 青青草国产成人久久91网| 国产农村妇女毛片精品久久| 久久人人爽人爽人人爽av| 久久精品卫校国产小美女| 久久青青草原综合伊人| 精品久久久一二三区| 97久久国产亚洲精品超碰热| 日韩精品无码久久一区二区三| 成人久久免费网站| 久久e热在这里只有国产中文精品99| 欧美精品国产综合久久| 9191精品国产免费久久| 亚洲精品无码久久久久sm| 精品久久人人做人人爽综合| 久久综合噜噜激激的五月天| 久久91精品综合国产首页| 99re这里只有精品热久久| 久久久久久国产精品美女| 九九久久精品国产| 国产成人久久久精品二区三区 | 久久久久亚洲AV无码专区网站| 亚洲精品无码久久久久AV麻豆| 亚洲成人精品久久| 精品乱码久久久久久久| 伊人久久大香线蕉亚洲| 狠狠色丁香婷婷久久综合| 久久艹国产| 久久精品?ⅴ无码中文字幕| 久久超乳爆乳中文字幕| 亚洲午夜久久久久久久久电影网| 久久婷婷午色综合夜啪| 无码任你躁久久久久久老妇| 久久国产综合精品五月天| 精品久久久久久国产免费了| a级毛片无码兔费真人久久| 精品免费久久久久国产一区| 四虎影视久久久免费观看| 久久久久久久久66精品片| 中文字幕久久精品无码|