Thứ Bảy, 2 tháng 4, 2022

CAPSO1 C++


#include<bits/stdc++.h>
#define mino "capso"
using namespace std;

int a, b, k;

int main()
{
    freopen(mino".inp","r",stdin);
    freopen(mino".out","w",stdout);

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    cin >> a >> b >> k;


    int L = ceil(sqrt(1.0*a));

    int u= ceil(cbrt(a));

    int res = 0;
    for(int x = L; x*x <= b; x++)
    {
        cout<<"x="<<x<<endl;
        for(int y = u; y*y*y <= b; y++)
        {cout<<"y="<<y<<endl;
            if( abs(x*x - y*y*y) <= k )
            {
                res++;
            }
        }
    }
    cout << res;
}



Không có nhận xét nào:

Đăng nhận xét

Lưu ý: Chỉ thành viên của blog này mới được đăng nhận xét.