闰年判断
【AC代码】:
#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"; else cout << "no"; }
【AC代码】:方法很多,最简单的。
#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; } } } } }
【AC代码】:可以以每个A为基准。
#include <iostream> #include <algorithm> using namespace std; #define MAX 26+1 int 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; } }
原文地址:http://blog.csdn.net/weijj6608/article/details/44164053