赞
踩
- #include <iostream>
- using namespace std;
- int main() {
- int n;
- cin >> n;
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < n; j++)
- cout << (char)('A' + (i + j) % 26);
- cout << endl;
- }
- return 0;
- }
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- int n, cnt = 0;
- cin >> n;
- for (int a = 1; a <= n; a++)
- for (int b = a; b <= n; b++) {
- int c2 = a * a + b * b;
- int c = (int)(sqrt(c2) + 0.5);
- if (c > n)
- break;
- if (c * c == c2)
- cnt++;
- }
- cout << cnt << endl;
- return 0;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。