Sequence characteristics
"AC Code":
#include <iostream> #include <algorithm>using namespace std; #define MAX 10000+10int Main () {int n = 0, i = 0;int Num[max];cin >> n;for (i = 0; i < n; i++) cin >> num[i];int mmin = num[0], Mmax = num[0], sum = num[0];for (i = 1; i < n; i++) {if (Num[i]>mmax) Mmax = num[i];if (num[i]<mmin) mmin = num[i];sum + = Num[i];} cout << mmax << endl;cout << mmin << endl;cout << sum << Endl;}
Find integer
"AC Code": NOTE-1
#include <iostream> #include <algorithm>using namespace std; #define MAX 1000+10int Main () {int n = 0, x = 0, i = 0;int num[max];cin >> n;for (i = 0; i < n; i++) cin >> num[i];cin >> x;for (i = 0; i < n; i++) {if (Num[i] = = x) {cout << I+1;return 0;}} cout <<-1;}
Yang Hui Triangle
"AC Code": Must be initialized. There are no spaces at the end of the line.
#include <iostream> #include <algorithm> #include <cstdio> #include <cstring>using namespace STD; #define MAX 34+2int Main () {//freopen ("In.txt", "R", stdin);//freopen ("OUT.txt", "w", stdout); int n = 0, i = 0, j = 0;i NT Tra[max][max];cin >> n;//initial first colmemset (tra, 0, sizeof); for (i = 0; i < n; i++) tra[i][0] = 1;//f Illfor (i = 1; i < n; i++) {for (j = 1; j < MAX-1; J + +) {Tra[i][j] = Tra[i-1][j-1] + tra[i-1][j];}} Outputfor (i = 0; i < n; i++) {for (j = 0; J < N; j + +) {if (0! = Tra[i][j]) {if (0 = = j) cout << tra[i][j];elsec Out << "" << Tra[i][j];}} cout << Endl;}}
Blue Bridge Cup basic-4~6 sequence features, finding integers, Yang hui triangles