fork download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. #define dandelion ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  4. #define fr(i,a,b) for(long long i=a;i<=b;i++)
  5. #define fd(i,a,b) for(long long i=a;i>=b;i--)
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11. dandelion
  12.  
  13. int n;
  14. cin>>n;
  15. ll r1 = 0, r2 = 0;
  16. int j = n;
  17. fr(i,1,n){
  18. r1 += i*i;
  19. r2 += (i*j);
  20. j--;
  21. }
  22. cout<<r1<<" "<<r2;
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
3532661503315 1766451372455