G.cpp 354 B

123456789101112131415161718
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main() {
  4. for (int m, n; cin >> m >> n;) {
  5. int x = 0, y = 0;
  6. for (int i = m; i <= n; i++) {
  7. if (i % 2) {
  8. y += i * i * i;
  9. } else {
  10. x += i * i;
  11. }
  12. }
  13. cout << x << " " << y << endl;;
  14. }
  15. return 0;
  16. }