合肥工业大学oj 1158 平方和与立方和

#include<iostream>
#include<algorithm>
using namespace std;

int m, n;

int main(){
     while(cin >> m >> n){
         if(m > n) swap(m, n);//99%的wa都是因为这个
        int x = 0, y = 0;
        for(int i = m; i <= n; i++){
            if(i % 2 == 0) x += i * i;
            else y += i * i * i;
        }
        cout << x << " " << y << endl;
    }
    
    return 0;
}

//presented by 大吉大利,今晚AC

猜你喜欢

转载自blog.csdn.net/lalala_HFUT/article/details/87943014