• <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>

            tianxuyuan

            置頂隨筆 #

            [置頂]自學(xué)class 可是做半天的題目 電腦上數(shù)據(jù)答案對(duì)了 提交是不對(duì)的 〔內(nèi)附題目 我的答案〕

            怎么這樣這樣?
            下面是提交后的顯示:
            編譯失敗...|錯(cuò)誤號(hào):1

            MyProger\Prog69647.cpp:24: error: expected `;' before '(' token
            MyProger\Prog69647.cpp:27: error: expected `;' before "int"
            MyProger\Prog69647.cpp: In function `int main()':
            MyProger\Prog69647.cpp:59: error: 'class Student' has no member named 'add'

            高手們大俠們救命阿!
            //=====================
            #include<iostream>
            #include<iomanip>
            using namespace std;
            //---------------------------------------------
            class Student{
             string name;
              int mark;
               int classmark;
                char isganbu;
                char isxibu;
                int lw;
                int jxj;
            public :
             void set(string na, int ma, int cl, char isga,char isxi,int l, int jx){
               name=na;mark=ma;classmark=cl;isganbu=isga;isxibu=isxi;lw=l;jxj=jx;
              }
             bool isys();
             bool isws();
             bool iscj();
             bool isxb();
             bool isbj();

             void  sumjxj(){
              if(isys()) jxj+=8000;
              if(isws()) jxj+=4000;
              if(iscj()) jxj+=2000;
              if(isxb()) jxj+=1000;
              if(isbj()) jxj+= 850;
              }
             int add(& sum){
              sum=sum+jxj ;
             }
             int  mmax(string & name1,int & jxj1){
              if(jxj>jxj1){ name1=name;jxj1=jxj ;}
                }
            };
            //-------------------------------------
             bool Student::isys(){
              return (mark>80&&lw>0);
              }
              bool Student::isws(){
               return (mark>85&&classmark>80 );
              }
              bool Student::iscj(){
               return (mark>90);
               }
              bool Student::isxb(){
               return (mark>85&&isxibu=='Y');
               }
              bool Student::isbj(){
               return (classmark>80&&isganbu=='Y');
               }
            //---------------------------------------
            int main(){
             string name1=" "; int jxj1=0; int sum=0;
             int n; cin>>n;
             for(;n;n--){
              Student x;
              string na; int ma; int cl; char isga;char isxi;int l; int jx=0;
              cin>>na>>ma>>cl>>isga>>isxi>>l;
              //jx=0;
              x.set(na,ma,cl,isga,isxi,l,jx);
              x.sumjxj();

              x.add(sum);
              x.mmax(name1,jxj1);

              }
             cout<<name1<<'\n';
             cout<<jxj1<<'\n';
             cout<<sum<<'\n';
              }

            描述 Description
                某校的慣例是在每學(xué)期的期末考試之后發(fā)放獎(jiǎng)學(xué)金。發(fā)放的獎(jiǎng)學(xué)金共有五種,獲取的條件各自不同:

              1)  院士獎(jiǎng)學(xué)金,每人8000元,期末平均成績(jī)高于80分(>80),并且在本學(xué)期內(nèi)發(fā)表1篇或1篇以上論文的學(xué)生均可獲得;

              2)  五四獎(jiǎng)學(xué)金,每人4000元,期末平均成績(jī)高于85分(>85),并且班級(jí)評(píng)議成績(jī)高于80分(>80)的學(xué)生均可獲得;

              3)  成績(jī)優(yōu)秀獎(jiǎng),每人2000元,期末平均成績(jī)高于90分(>90)的學(xué)生均可獲得;

              4)  西部獎(jiǎng)學(xué)金,每人1000元,期末平均成績(jī)高于85分(>85)的西部省份學(xué)生均可獲得;

              5)  班級(jí)貢獻(xiàn)獎(jiǎng),每人850元,班級(jí)評(píng)議成績(jī)高于80分(>80)的學(xué)生干部均可獲得;

              只要符合條件就可以得獎(jiǎng),每項(xiàng)獎(jiǎng)學(xué)金的獲獎(jiǎng)人數(shù)沒(méi)有限制,每名學(xué)生也可以同時(shí)獲得多項(xiàng)獎(jiǎng)學(xué)金。例如姚林的期末平均成績(jī)是87分,班級(jí)評(píng)議成績(jī)82分,同時(shí)他還是一位學(xué)生干部,那么他可以同時(shí)獲得五四獎(jiǎng)學(xué)金和班級(jí)貢獻(xiàn)獎(jiǎng),獎(jiǎng)金總數(shù)是4850元。

              現(xiàn)在給出若干學(xué)生的相關(guān)數(shù)據(jù),請(qǐng)計(jì)算哪些同學(xué)獲得的獎(jiǎng)金總數(shù)最高(假設(shè)總有同學(xué)能滿(mǎn)足獲得獎(jiǎng)學(xué)金的條件)。
            輸入格式 Input Format
                輸入的第一行是一個(gè)整數(shù)N(1 <= N <= 100),表示學(xué)生的總數(shù)。接下來(lái)的N行每行是一位學(xué)生的數(shù)據(jù),從左向右依次是姓名,期末平均成績(jī),班級(jí)評(píng)議成績(jī),是否是學(xué)生干部,是否是西部省份學(xué)生,以及發(fā)表的論文數(shù)。姓名是由大小寫(xiě)英文字母組成的長(zhǎng)度不超過(guò)20的字符串(不含空格);期末平均成績(jī)和班級(jí)評(píng)議成績(jī)都是0到100之間的整數(shù)(包括0和100);是否是學(xué)生干部和是否是西部省份學(xué)生分別用一個(gè)字符表示,Y表示是,N表示不是;發(fā)表的論文數(shù)是0到10的整數(shù)(包括0和10)。每?jī)蓚€(gè)相鄰數(shù)據(jù)項(xiàng)之間用一個(gè)空格分隔。
            輸出格式 Output Format
                輸出包括三行,第一行是獲得最多獎(jiǎng)金的學(xué)生的姓名,第二行是這名學(xué)生獲得的獎(jiǎng)金總數(shù)。如果有兩位或兩位以上的學(xué)生獲得的獎(jiǎng)金最多,輸出他們之中在輸入文件中出現(xiàn)最早的學(xué)生的姓名。第三行是這N個(gè)學(xué)生獲得的獎(jiǎng)學(xué)金的總數(shù)。

            in
            4
            YaoLin 87 82 Y N 0
            ChenRuiyi 88 78 N Y 1
            LiXin 92 88 N N 0
            ZhangQin 83 87 Y N 1
            out
            ChenRuiyi
            9000
            28700

            posted @ 2007-08-16 23:01 田旭園 閱讀(676) | 評(píng)論 (5)編輯 收藏

            [置頂]放假在家 學(xué)習(xí)類(lèi) 今天編了日期簡(jiǎn)單處理的

            //===========================
            #include<iostream>
            #include<iomanip>
            //========================
            using namespace std;
            class Date{
             int year,month,day;
            public:
             bool isleapyear(){
               return(year%4==0&&year%100!=0)||(year%400==0);
               }
             void print(){
              cout<<setfill('0');
              cout<<setw(4)<<year<<'-'<<setw(2)<<month<<'-'<<setw(2)<<day<<'\n';
              cout<<setfill(' ');
              }
              void set(int y,int m,int d){
               year=y;  month=m; day=d;
              }
             };
            //--------------------------
            int main(){
             Date kk;
             int n;cin>>n;
             for(int i=1;i<=n;i++){
                int y;int m;int d;
                 cin>>y>>m>>d;                                   //  kk.set(1000,8,16);
                 kk.set(y,m,d);
                if(kk.isleapyear()) kk.print();
                 else cout<<"notleap\n";
              }
             cout<<"over"<<'\n';
            }
            //--------------------------

            想用類(lèi)做8個(gè)排序算法 有點(diǎn)沒(méi)有頭緒阿

            posted @ 2007-08-16 11:15 田旭園 閱讀(328) | 評(píng)論 (1)編輯 收藏

            [置頂]待做

            Sorting by Swapping
            Time Limit:1000MS  Memory Limit:10000K
            Total Submit:2515 Accepted:1374

            Description
            Given a permutation of numbers from 1 to n, we can always get the sequence 1, 2, 3, ..., n by swapping pairs of numbers. For example, if the initial sequence is 2, 3, 5, 4, 1, we can sort them in the following way:

            2 3 5 4 1
            1 3 5 4 2
            1 3 2 4 5
            1 2 3 4 5

            Here three swaps have been used. The problem is, given a specific permutation, how many swaps we needs to take at least.


            Input
            The first line contains a single integer t (1 <= t <= 20) that indicates the number of test cases. Then follow the t cases. Each case contains two lines. The first line contains the integer n (1 <= n <= 10000), and the second line gives the initial permutation.

            Output
            For each test case, the output will be only one integer, which is the least number of swaps needed to get the sequence 1, 2, 3, ..., n from the initial permutation.

            Sample Input


            2
            3
            1 2 3
            5
            2 3 5 4 1

            Sample Output


            0
            3

            posted @ 2007-05-05 11:17 田旭園 閱讀(616) | 評(píng)論 (1)編輯 收藏

            2007年8月16日 #

            自學(xué)class 可是做半天的題目 電腦上數(shù)據(jù)答案對(duì)了 提交是不對(duì)的 〔內(nèi)附題目 我的答案〕

            怎么這樣這樣?
            下面是提交后的顯示:
            編譯失敗...|錯(cuò)誤號(hào):1

            MyProger\Prog69647.cpp:24: error: expected `;' before '(' token
            MyProger\Prog69647.cpp:27: error: expected `;' before "int"
            MyProger\Prog69647.cpp: In function `int main()':
            MyProger\Prog69647.cpp:59: error: 'class Student' has no member named 'add'

            高手們大俠們救命阿!
            //=====================
            #include<iostream>
            #include<iomanip>
            using namespace std;
            //---------------------------------------------
            class Student{
             string name;
              int mark;
               int classmark;
                char isganbu;
                char isxibu;
                int lw;
                int jxj;
            public :
             void set(string na, int ma, int cl, char isga,char isxi,int l, int jx){
               name=na;mark=ma;classmark=cl;isganbu=isga;isxibu=isxi;lw=l;jxj=jx;
              }
             bool isys();
             bool isws();
             bool iscj();
             bool isxb();
             bool isbj();

             void  sumjxj(){
              if(isys()) jxj+=8000;
              if(isws()) jxj+=4000;
              if(iscj()) jxj+=2000;
              if(isxb()) jxj+=1000;
              if(isbj()) jxj+= 850;
              }
             int add(& sum){
              sum=sum+jxj ;
             }
             int  mmax(string & name1,int & jxj1){
              if(jxj>jxj1){ name1=name;jxj1=jxj ;}
                }
            };
            //-------------------------------------
             bool Student::isys(){
              return (mark>80&&lw>0);
              }
              bool Student::isws(){
               return (mark>85&&classmark>80 );
              }
              bool Student::iscj(){
               return (mark>90);
               }
              bool Student::isxb(){
               return (mark>85&&isxibu=='Y');
               }
              bool Student::isbj(){
               return (classmark>80&&isganbu=='Y');
               }
            //---------------------------------------
            int main(){
             string name1=" "; int jxj1=0; int sum=0;
             int n; cin>>n;
             for(;n;n--){
              Student x;
              string na; int ma; int cl; char isga;char isxi;int l; int jx=0;
              cin>>na>>ma>>cl>>isga>>isxi>>l;
              //jx=0;
              x.set(na,ma,cl,isga,isxi,l,jx);
              x.sumjxj();

              x.add(sum);
              x.mmax(name1,jxj1);

              }
             cout<<name1<<'\n';
             cout<<jxj1<<'\n';
             cout<<sum<<'\n';
              }

            描述 Description
                某校的慣例是在每學(xué)期的期末考試之后發(fā)放獎(jiǎng)學(xué)金。發(fā)放的獎(jiǎng)學(xué)金共有五種,獲取的條件各自不同:

              1)  院士獎(jiǎng)學(xué)金,每人8000元,期末平均成績(jī)高于80分(>80),并且在本學(xué)期內(nèi)發(fā)表1篇或1篇以上論文的學(xué)生均可獲得;

              2)  五四獎(jiǎng)學(xué)金,每人4000元,期末平均成績(jī)高于85分(>85),并且班級(jí)評(píng)議成績(jī)高于80分(>80)的學(xué)生均可獲得;

              3)  成績(jī)優(yōu)秀獎(jiǎng),每人2000元,期末平均成績(jī)高于90分(>90)的學(xué)生均可獲得;

              4)  西部獎(jiǎng)學(xué)金,每人1000元,期末平均成績(jī)高于85分(>85)的西部省份學(xué)生均可獲得;

              5)  班級(jí)貢獻(xiàn)獎(jiǎng),每人850元,班級(jí)評(píng)議成績(jī)高于80分(>80)的學(xué)生干部均可獲得;

              只要符合條件就可以得獎(jiǎng),每項(xiàng)獎(jiǎng)學(xué)金的獲獎(jiǎng)人數(shù)沒(méi)有限制,每名學(xué)生也可以同時(shí)獲得多項(xiàng)獎(jiǎng)學(xué)金。例如姚林的期末平均成績(jī)是87分,班級(jí)評(píng)議成績(jī)82分,同時(shí)他還是一位學(xué)生干部,那么他可以同時(shí)獲得五四獎(jiǎng)學(xué)金和班級(jí)貢獻(xiàn)獎(jiǎng),獎(jiǎng)金總數(shù)是4850元。

              現(xiàn)在給出若干學(xué)生的相關(guān)數(shù)據(jù),請(qǐng)計(jì)算哪些同學(xué)獲得的獎(jiǎng)金總數(shù)最高(假設(shè)總有同學(xué)能滿(mǎn)足獲得獎(jiǎng)學(xué)金的條件)。
            輸入格式 Input Format
                輸入的第一行是一個(gè)整數(shù)N(1 <= N <= 100),表示學(xué)生的總數(shù)。接下來(lái)的N行每行是一位學(xué)生的數(shù)據(jù),從左向右依次是姓名,期末平均成績(jī),班級(jí)評(píng)議成績(jī),是否是學(xué)生干部,是否是西部省份學(xué)生,以及發(fā)表的論文數(shù)。姓名是由大小寫(xiě)英文字母組成的長(zhǎng)度不超過(guò)20的字符串(不含空格);期末平均成績(jī)和班級(jí)評(píng)議成績(jī)都是0到100之間的整數(shù)(包括0和100);是否是學(xué)生干部和是否是西部省份學(xué)生分別用一個(gè)字符表示,Y表示是,N表示不是;發(fā)表的論文數(shù)是0到10的整數(shù)(包括0和10)。每?jī)蓚€(gè)相鄰數(shù)據(jù)項(xiàng)之間用一個(gè)空格分隔。
            輸出格式 Output Format
                輸出包括三行,第一行是獲得最多獎(jiǎng)金的學(xué)生的姓名,第二行是這名學(xué)生獲得的獎(jiǎng)金總數(shù)。如果有兩位或兩位以上的學(xué)生獲得的獎(jiǎng)金最多,輸出他們之中在輸入文件中出現(xiàn)最早的學(xué)生的姓名。第三行是這N個(gè)學(xué)生獲得的獎(jiǎng)學(xué)金的總數(shù)。

            in
            4
            YaoLin 87 82 Y N 0
            ChenRuiyi 88 78 N Y 1
            LiXin 92 88 N N 0
            ZhangQin 83 87 Y N 1
            out
            ChenRuiyi
            9000
            28700

            posted @ 2007-08-16 23:01 田旭園 閱讀(676) | 評(píng)論 (5)編輯 收藏

            放假在家 學(xué)習(xí)類(lèi) 今天編了日期簡(jiǎn)單處理的

            //===========================
            #include<iostream>
            #include<iomanip>
            //========================
            using namespace std;
            class Date{
             int year,month,day;
            public:
             bool isleapyear(){
               return(year%4==0&&year%100!=0)||(year%400==0);
               }
             void print(){
              cout<<setfill('0');
              cout<<setw(4)<<year<<'-'<<setw(2)<<month<<'-'<<setw(2)<<day<<'\n';
              cout<<setfill(' ');
              }
              void set(int y,int m,int d){
               year=y;  month=m; day=d;
              }
             };
            //--------------------------
            int main(){
             Date kk;
             int n;cin>>n;
             for(int i=1;i<=n;i++){
                int y;int m;int d;
                 cin>>y>>m>>d;                                   //  kk.set(1000,8,16);
                 kk.set(y,m,d);
                if(kk.isleapyear()) kk.print();
                 else cout<<"notleap\n";
              }
             cout<<"over"<<'\n';
            }
            //--------------------------

            想用類(lèi)做8個(gè)排序算法 有點(diǎn)沒(méi)有頭緒阿

            posted @ 2007-08-16 11:15 田旭園 閱讀(328) | 評(píng)論 (1)編輯 收藏

            2007年5月22日 #

            剛作好的 叫DNA 想用取余的做可是做不出來(lái) 高人幫忙~~

            Input:

            輸入包含多組測(cè)試數(shù)據(jù)。第一個(gè)整數(shù)N(N<=15),N表示組數(shù),每組數(shù)據(jù)包含兩個(gè)整數(shù)a,b。a表示一個(gè)單位的DNA串的行數(shù),a為奇數(shù)且 3<=a<=39。b表示重復(fù)度(1<=b<=20)。

            Output:

            輸出DNA的形狀,每組輸出間有一空行。

            Sample Input:

            2
            3 1
            5 4

            Sample Output:

            X X
            X
            X X
            X   X
            X X
            X
            X X
            X   X
            X X
            X
            X X
            X   X
            X X
            X
            X X
            X   X
            X X
            X
            X X
            X   X



            #include<iostream>
            #include<string>
            using namespace std;
            int main()
            {

            int n; cin>>n;
            int m=1;
            for(int a,b;n&&cin>>a>>b;n--)
            { cout<<(m==1?"":"\n");

             for(int i=1;i<=b;i++)
              {for(int j=1;j<=a/2;j++)
              {
               cout<<string(j-1,' ');
               cout<<'X';
               cout<<string(a-2*(j-1)-2,' ');
               cout<<'X'<<'\n';
               }
                cout<<string(a/2,' ');
                cout<<'X'<<'\n';
                for(int i=a/2;i>1;i--)
                { cout<<string(i-1,' ');
                  cout<<'X';
               cout<<string(a-2*(i-1)-2,' ');
               cout<<'X'<<'\n';
               }
               }
              cout<<'X';cout<<string(a-2,' ');
              cout<<'X'<<'\n';


              m++;
              }

              }

            posted @ 2007-05-22 18:30 田旭園 閱讀(479) | 評(píng)論 (0)編輯 收藏

            2007年5月6日 #

            I wish

            #include<stdio.h>
            void main()
            {
              int day;
              for(day=1;day<=365;day++)
                  printf("I wish you happy everyday!\n");
            }

            posted @ 2007-05-06 14:26 田旭園 閱讀(635) | 評(píng)論 (2)編輯 收藏

            2007年5月5日 #

            StrInt + - * /(整除) % (取模)

            / StrInt + - * /(整除) % (取模)
            //=====================================
            #ifndef STRINT_HEADER
            #define STRINT_HEADER
            #include<iostream>
            using namespace std;
            //-------------------------------------
            class StrInt{
              enum { BYTENUM = 200 };
              string _sign;
              string _num;
            public:
              StrInt(const string& a = string("0") );
              StrInt(const string& sign, const string& num);
              friend StrInt mul( const StrInt& a, const StrInt& b );
              friend StrInt add( const StrInt& a, const StrInt& b );
              friend StrInt sub( const StrInt& a, const StrInt& b );
              friend StrInt div( const StrInt& a, const StrInt& b );
              friend StrInt mod( const StrInt& a, const StrInt& b );
              friend istream& operator>>(istream& in, StrInt& a);
              friend ostream& operator<<(ostream& out, const StrInt& a);
            };//-----------------------------------
            #endif   // STRINT_HEADER

            posted @ 2007-05-05 11:20 田旭園 閱讀(1544) | 評(píng)論 (0)編輯 收藏

            待做

            Sorting by Swapping
            Time Limit:1000MS  Memory Limit:10000K
            Total Submit:2515 Accepted:1374

            Description
            Given a permutation of numbers from 1 to n, we can always get the sequence 1, 2, 3, ..., n by swapping pairs of numbers. For example, if the initial sequence is 2, 3, 5, 4, 1, we can sort them in the following way:

            2 3 5 4 1
            1 3 5 4 2
            1 3 2 4 5
            1 2 3 4 5

            Here three swaps have been used. The problem is, given a specific permutation, how many swaps we needs to take at least.


            Input
            The first line contains a single integer t (1 <= t <= 20) that indicates the number of test cases. Then follow the t cases. Each case contains two lines. The first line contains the integer n (1 <= n <= 10000), and the second line gives the initial permutation.

            Output
            For each test case, the output will be only one integer, which is the least number of swaps needed to get the sequence 1, 2, 3, ..., n from the initial permutation.

            Sample Input


            2
            3
            1 2 3
            5
            2 3 5 4 1

            Sample Output


            0
            3

            posted @ 2007-05-05 11:17 田旭園 閱讀(616) | 評(píng)論 (1)編輯 收藏

            僅列出標(biāo)題  
            婷婷久久综合九色综合九七| 色诱久久久久综合网ywww| 久久线看观看精品香蕉国产| 999久久久国产精品| 一本久道久久综合狠狠躁AV| 久久婷婷五月综合国产尤物app| 色综合久久天天综合| 狠狠色丁香久久婷婷综合蜜芽五月| 精品久久人人爽天天玩人人妻| 久久99国产综合精品免费| 九九热久久免费视频| 亚洲国产精品无码久久久蜜芽| 欧美精品一本久久男人的天堂| 麻豆av久久av盛宴av| 嫩草影院久久99| 久久综合噜噜激激的五月天| 久久精品国产99久久香蕉| 91久久精品91久久性色| 久久这里都是精品| 99久久精品免费观看国产| 一本久道久久综合狠狠躁AV| 香港aa三级久久三级| 一本久道久久综合狠狠爱| 久久人人爽人人爽人人片AV东京热| 粉嫩小泬无遮挡久久久久久| 久久国产亚洲精品| 蜜桃麻豆www久久国产精品| 久久综合综合久久狠狠狠97色88| 久久天堂AV综合合色蜜桃网| 亚洲国产成人精品久久久国产成人一区二区三区综 | 91精品国产91久久久久久青草| 国产69精品久久久久9999APGF| 青青草原综合久久大伊人导航| 99久久免费国产精精品| 99久久99久久久精品齐齐| 久久综合88熟人妻| 日韩精品久久久久久久电影蜜臀 | 亚洲国产成人精品无码久久久久久综合 | 国产L精品国产亚洲区久久| 99久久无色码中文字幕| MM131亚洲国产美女久久|