From 26ddcc5cd4d10de39d711bb689c81b243e92dfd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=85=E4=B9=90=E4=B9=90?= <44996764+shuailele@users.noreply.github.com> Date: Wed, 5 Dec 2018 17:24:50 +0800 Subject: [PATCH 1/5] mengfanle --- mengfanle/IOS CLUB three.cpp | 75 ++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 mengfanle/IOS CLUB three.cpp diff --git a/mengfanle/IOS CLUB three.cpp b/mengfanle/IOS CLUB three.cpp new file mode 100644 index 0000000..ca6cb43 --- /dev/null +++ b/mengfanle/IOS CLUB three.cpp @@ -0,0 +1,75 @@ +#include +using namespace std; +int main() +{ + int y[4][13]={{0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0}}; + int l,i,h,h1,h2,h3,c,m,n,j,k; + cout<<"please input numbers:"; + + for(i=1;i<=12;i++) //执行12次循环 输入12次数 并为二维数组的每列赋值 + { + cin>>h; + l=i; + for(c=0;(h-c)>0;c++) //为一列中数组的元素赋值 + y[h-c][l]=2; + + } +/*for(h=1;h<=3;h++) +for(l=1;l<=12;l++) +{ +cout<0;c++) + { + if(y[h-c][l]==2) + for(k=l+1;k<=12;k++) + { + if(y[h-c][k]==2) + {for(j=l+1;j0;c++) + if(y[h-c][l]==2) + y[h-c][l]=0; + } + +/*for(h=1;h<=3;h++) +for(l=1;l<=12;l++) +{ +cout< Date: Sat, 8 Dec 2018 13:24:12 +0800 Subject: [PATCH 2/5] Delete IOS CLUB three.cpp --- mengfanle/IOS CLUB three.cpp | 75 ------------------------------------ 1 file changed, 75 deletions(-) delete mode 100644 mengfanle/IOS CLUB three.cpp diff --git a/mengfanle/IOS CLUB three.cpp b/mengfanle/IOS CLUB three.cpp deleted file mode 100644 index ca6cb43..0000000 --- a/mengfanle/IOS CLUB three.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include -using namespace std; -int main() -{ - int y[4][13]={{0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0}}; - int l,i,h,h1,h2,h3,c,m,n,j,k; - cout<<"please input numbers:"; - - for(i=1;i<=12;i++) //执行12次循环 输入12次数 并为二维数组的每列赋值 - { - cin>>h; - l=i; - for(c=0;(h-c)>0;c++) //为一列中数组的元素赋值 - y[h-c][l]=2; - - } -/*for(h=1;h<=3;h++) -for(l=1;l<=12;l++) -{ -cout<0;c++) - { - if(y[h-c][l]==2) - for(k=l+1;k<=12;k++) - { - if(y[h-c][k]==2) - {for(j=l+1;j0;c++) - if(y[h-c][l]==2) - y[h-c][l]=0; - } - -/*for(h=1;h<=3;h++) -for(l=1;l<=12;l++) -{ -cout< Date: Sat, 8 Dec 2018 13:24:36 +0800 Subject: [PATCH 3/5] mengfanle --- mengfanle/ios club three week.cpp | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 mengfanle/ios club three week.cpp diff --git a/mengfanle/ios club three week.cpp b/mengfanle/ios club three week.cpp new file mode 100644 index 0000000..fea1892 --- /dev/null +++ b/mengfanle/ios club three week.cpp @@ -0,0 +1,40 @@ +#include +#include +#include + +using namespace std; +int main() { + string n; //瀹氫箟瀛楃涓插彉閲 + int i,a,s,b=0; //i鐢ㄦ潵琛ㄧず杈撳叆瀛楃涓茬殑闀垮害 a鐢ㄦ潵璁板綍绗竴娆¢亣鍒版湁楂樺害鐨勬煴瀛愮殑鏁扮粍浣嶇疆 s琛ㄧず闆ㄦ按闈㈢Н b鐢ㄦ潵璁板綍绗簩娆¢亣鍒版湁楂樺害鐨勬煴瀛愮殑鏁扮粍浣嶇疆 + cout<<"璇疯緭鍏ユ暟鎹:"; + cin>>n; + i=strlen(n);//鐢ㄦ潵娴嬪畾瀛楃涓插彉閲忕殑闀垮害 + + + for(int c=1;c<=i;c++) { //浣垮惊鐜墽琛宨娆 + for (int j = b; n > j; j++) { //姝or璇彞鐢ㄦ潵鎵惧埌绗竴娆℃湁楂樺害鐨勬煴瀛愮殑鏁扮粍浣嶇疆骞惰褰 + if (n[j] != 0) { + a = j; + break; + } + } + + + for (int c = a + 1; n>c; c++) { //姝or璇彞鐢ㄦ潵鎵惧埌绗簩娆℃湁楂樺害鐨勬煴瀛愮殑鏁扮粍浣嶇疆骞惰褰曚互鍙婄畻鍑虹涓娆$殑鏌卞瓙涓庣浜屾鐨勬煴瀛愪箣闂寸殑闈㈢Н + if (n[c] >= n[a]) { + s = (c - 1) * n[a]; + b = c; + break; + } + } + + + for (int c = a + 1; c < b; c++) { //姝or璇彞鐢ㄦ潵灏嗕箣鍓嶇畻鍑虹殑闈㈢Н閲岀殑鏌卞瓙鍑忔帀 + s = s - n[c]; + } + } + + + cout<<"鍙互鎺ョ殑闆ㄦ按涓暟涓:"< Date: Sun, 9 Dec 2018 15:25:03 +0800 Subject: [PATCH 4/5] Delete ios club three week.cpp --- mengfanle/ios club three week.cpp | 40 ------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 mengfanle/ios club three week.cpp diff --git a/mengfanle/ios club three week.cpp b/mengfanle/ios club three week.cpp deleted file mode 100644 index fea1892..0000000 --- a/mengfanle/ios club three week.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include -#include - -using namespace std; -int main() { - string n; //瀹氫箟瀛楃涓插彉閲 - int i,a,s,b=0; //i鐢ㄦ潵琛ㄧず杈撳叆瀛楃涓茬殑闀垮害 a鐢ㄦ潵璁板綍绗竴娆¢亣鍒版湁楂樺害鐨勬煴瀛愮殑鏁扮粍浣嶇疆 s琛ㄧず闆ㄦ按闈㈢Н b鐢ㄦ潵璁板綍绗簩娆¢亣鍒版湁楂樺害鐨勬煴瀛愮殑鏁扮粍浣嶇疆 - cout<<"璇疯緭鍏ユ暟鎹:"; - cin>>n; - i=strlen(n);//鐢ㄦ潵娴嬪畾瀛楃涓插彉閲忕殑闀垮害 - - - for(int c=1;c<=i;c++) { //浣垮惊鐜墽琛宨娆 - for (int j = b; n > j; j++) { //姝or璇彞鐢ㄦ潵鎵惧埌绗竴娆℃湁楂樺害鐨勬煴瀛愮殑鏁扮粍浣嶇疆骞惰褰 - if (n[j] != 0) { - a = j; - break; - } - } - - - for (int c = a + 1; n>c; c++) { //姝or璇彞鐢ㄦ潵鎵惧埌绗簩娆℃湁楂樺害鐨勬煴瀛愮殑鏁扮粍浣嶇疆骞惰褰曚互鍙婄畻鍑虹涓娆$殑鏌卞瓙涓庣浜屾鐨勬煴瀛愪箣闂寸殑闈㈢Н - if (n[c] >= n[a]) { - s = (c - 1) * n[a]; - b = c; - break; - } - } - - - for (int c = a + 1; c < b; c++) { //姝or璇彞鐢ㄦ潵灏嗕箣鍓嶇畻鍑虹殑闈㈢Н閲岀殑鏌卞瓙鍑忔帀 - s = s - n[c]; - } - } - - - cout<<"鍙互鎺ョ殑闆ㄦ按涓暟涓:"< Date: Sun, 9 Dec 2018 15:27:11 +0800 Subject: [PATCH 5/5] mengfanle --- mengfanle/IOS CLUB three week.cpp | 78 +++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 mengfanle/IOS CLUB three week.cpp diff --git a/mengfanle/IOS CLUB three week.cpp b/mengfanle/IOS CLUB three week.cpp new file mode 100644 index 0000000..0d5f562 --- /dev/null +++ b/mengfanle/IOS CLUB three week.cpp @@ -0,0 +1,78 @@ +#include +#include + +using namespace std; +int main() { + string n; //定义字符串变量 + int i,a,b=0,max,l,s,s1=0,s2=0,s3,q=0,t=0; //i用来表示输入字符串的长度 a用来记录第一次遇到有高度的柱子的数组位置 s表示雨水面积 b用来记录第二次遇到有高度的柱子的数组位置 + cout<<"please input:"; + getline(cin,n); + i=n.length();//用来测定字符串变量的长度 + i=i/2+1; + for(int z=0;z<2*i;z=z+2) //找出数组中含有最大值的列 + { + if(n[z]>=max) {max=n[z]; + l=z;} + } + for(int c=1;c<=i;c++) //使循环执行i次 +{ + + for (int j = b; j '0') { + a = j; + q++; + break; + } + } + + for (int f = a + 2; f<=l; f=f+2) { //此for语句用来找到第二次有高度的柱子的数组位置并记录以及算出第一次的柱子与第二次的柱子之间的面积 + if (n[f] >= n[a]) { + s =n[a]%48*((f-a-2)/2); + b = f; + break; + } + } + for (int d = a + 2; d < b; d=d+2) //此for语句用来将之前算出的面积里的柱子减掉 + { + s = s - n[d]%48; + } + if(c>q) break; + s1=s1+s; + +} + + + + + +if(b>=l){ //如果循环遇到最大值使运算反向执行 +b=i-1; +b=b*2; + for(int c=1;c<=i;c++) { //使循环执行i次 + + for (int j = b; j>l; c=c-2) { //此for语句用来找到第一次有高度的柱子的数组位置并记录 + if (n[j] >'0') { + a = j; + t++; + break; + } + } + for (int e = a - 2;e>=l; e=e-2) { //此for语句用来找到第二次有高度的柱子的数组位置并记录以及算出第一次的柱子与第二次的柱子之间的面积 + if (n[e] >= n[a]) { + s = ((a - e-2)/2)*(n[a]%48); + b = e; + break; + } + } + for (int d = a - 2; b < d; d=d-2) { //此for语句用来将之前算出的面积里的柱子减掉 + s = s - n[d]%48; + } + if(c>t) break; +s2=s2+s; + } +} + + s3=s1+s2; + cout<<"the rain is:"<