Blue Bridge cup BASIC-1 ~ 3 leap year judgment, 01 substrings, letter graphics, basic-101 children
Leap year judgment
[AC code ]:
#include <iostream>#include <algorithm>using namespace std;int main(){int y = 0;cin >> y;if (((0==y%4)&&(0!=y%100))||(0==y%400))cout << "yes";elsecout << "no";}
01 substring
[AC code]: There are many methods, the simplest.
#include <iostream>#include <algorithm>using namespace std;int main(){int i, j, k, m, n;for (i = 0; i < 2; i++){for (j = 0; j < 2; j++){for (k = 0; k < 2; k++){for (m = 0; m < 2; m++){for (n = 0; n < 2; n++)cout << i << j << k << m << n << endl;}}}}}
Letter graphics
[AC code]: can be based on each.
#include <iostream>#include <algorithm>using namespace std;#define MAX 26+1int main(){char gra[MAX][MAX];int n = 0, m = 0, t = 0;int i = 0, j = 0;;cin >> n >> m;t = m>n?n:m;for (i = 0; i < t; i++){gra[i][i] = 'A';for (j = i+1; j < m; j++)gra[i][j] = 'A'+j-i;for (j = i+1; j < n; j++)gra[j][i] = 'A'+j-i;}for (i = 0; i < n; i++){for (j = 0; j < m; j++)cout << gra[i][j];cout << endl;}}