• LCOJ
  • Trang chủ
  • 🧩 Problems
  • 📤 Submissions
  • 👥 Users
    >
    • 🏛️ Organizations
  • 🏆 Contests
  • 📚 Resources
    >
    • 🐍 Học Python
    • 💵 Tài chính cá nhân
    • 📝 Blog
  • ℹ️ About
    >
    • 📝 LCOJ docs
    • 🟢 Status
    • 💡 Mẹo
    • 📘 FAQ
VI EN Đăng nhập  hoặc  Đăng ký

qixi

  • Thông tin
  • Thống kê
  • Blog

Số bài đã giải: 31
Hạng điểm: #3689
Tổng điểm: 31,67
Đóng góp: 0

Xem các bài nộp

Thông tin

include <bits/stdc++.h>

using namespace std; void ptbac1() { long long a,b,c,tuso,gcd; long double xapxi; cout<<"nhap he so a vao day:"<<endl; cin>>a; cout<<"nhap he so b vao day:"<<endl; cin>>b; cout<<"nhap he so c vao day:"<<endl; cin>>c; tuso = (c-b); gcd = _gcd(tuso,a); tuso = tuso/gcd; a = a/gcd; if (tuso <0 && a < 0) { tuso = abs(tuso); a = abs(a); } if (a == 1) { cout<<"x="<<tuso; } else { cout<<"x="<<tuso<<"/"<<a<<endl; } xapxi = (c-b); cout<<"gia tri xap xi bang:"<<fixed<<setprecision(4)<<xapxi/a; } void hpt() { long long a,b,c,d,e,f; long double xapxix,xapxiy; cout<<"nhap he so a vao day:"<<endl; cin>>a; cout<<"nhap he so b vao day:"<<endl; cin>>b; cout<<"nhap he so c vao day:"<<endl; cin>>c; cout<<"nhap he so d vao day:"<<endl; cin>>d; cout<<"nhap he so e vao day:"<<endl; cin>>e; cout<<"nhap he so f vao day:"<<endl; cin>>f; long double x,y; if ((f*a) - d*c == 0 && d*b - a*e == 0) { cout<<"VOSONGHIEM"; return; } if (d*b - a*e == 0) { cout<<"VONGHIEM"; return; } int rutgon1,rutgon2,gcd; rutgon1 = f*a - d*c; rutgon2 = d*b - a*e; gcd = _gcd(rutgon1,rutgon2); rutgon1 = -rutgon1/gcd; rutgon2 = rutgon2/gcd; y = -((fa)-dc)/(db-ae); int rutgon3,rutgon4,gcd2;

rutgon3 = f*b-e*c;
rutgon4 = d*b-a*e;
gcd2 = __gcd(rutgon3,rutgon4);
rutgon3 = rutgon3/gcd2;
rutgon4 = rutgon4/gcd2;
if (rutgon3 &lt;0 && rutgon4 &lt;0) {
    rutgon3 = abs(rutgon3);
    rutgon4= abs(rutgon4);
}
if (rutgon1 &lt;0 && rutgon2 &lt;0) {
    rutgon1 = abs(rutgon1);
    rutgon2= abs(rutgon2);
}
cout<<"x="<&lt;rutgon3&lt;&lt;"/"<&lt;rutgon4&lt;&lt;endl;
cout<<"y="<&lt;rutgon1&lt;&lt;"/"<&lt;rutgon2&lt;&lt;endl;
xapxix = rutgon3;
xapxiy = rutgon1;
cout<<"gia tri cua x xap xi bang:"<&lt;fixed&lt;&lt;setprecision(4)&lt;&lt;xapxix/rutgon4<&lt;endl;
cout<<"gia tri cua y xap xi bang:"<&lt;fixed&lt;&lt;setprecision(4)&lt;&lt;xapxiy/rutgon2;
return;

} void ptbac2 () { long long a,b,c,delta,mauso,tuso,sq,i,mausobandau,b2,deltabandau; long double xapxix,xapxix2; cout<<"nhap he so a vao day:"<<endl; cin>>a; cout<<"nhap he so b vao day:"<<endl; cin>>b; cout<<"nhap he so c vao day:"<<endl; cin>>c; mausobandau = 2a; b2 = b; delta = bb-4ac; deltabandau = b2b2-4ac; mauso = 2a; if (delta > 0) { long long songoaican,nhantu,nhantu2,sotrongcan,kt,tuso2,mauso2; sq = sqrt(delta); if (delta== sq*sq) { songoaican = sqrt(delta); tuso = -b+songoaican; tuso2 = -b-songoaican; mauso2 = mauso; long long gcd2 = _gcd(mauso2,tuso2); long long gcd1 = _gcd(mauso,tuso); tuso = tuso/gcd1; tuso2 = tuso2/gcd2; mauso = mauso/gcd1; mauso2= mauso2/gcd2; cout<<"x1="<<tuso<<"/"<<mauso<<endl; cout<<"x2="<<tuso2<<"/"<<mauso2<<endl; xapxix = (-b2+sqrt(deltabandau)); xapxix2 = (-b2-sqrt(deltabandau)); cout<<"gia tri cua x1 xap xi bang:"<<fixed<<setprecision(4)<<xapxix/mausobandau<<endl; cout<<"gia tri cua x2 xap xi bang:"<<fixed<<setprecision(4)<<xapxix2/mausobandau;

    } else {
        for (i = delta; i>=1;i--) {
            int ktsocan = sqrt(i);
            if (ktsocan * ktsocan == i && delta%i == 0) {
                    kt = i;
                    break;
            }
        }
        if (delta % kt == 0) {
            songoaican = sqrt(kt);
            sotrongcan = delta/kt;
        } else {
            sotrongcan = delta % kt;
            songoaican = sqrt(kt);
        }
    nhantu = __gcd(b,songoaican);
    b = b/nhantu;
    songoaican = songoaican/nhantu;
    nhantu2 = __gcd(mauso,nhantu);
    nhantu = nhantu/nhantu2;
    mauso = mauso/nhantu2;
    b = b*nhantu;
    songoaican = songoaican*nhantu;
    if (mauso == 1) {
        int again = __gcd(b, songoaican);
    b = -b/again;
    songoaican = songoaican/again;
    }
    cout<<"x1="<<-b<<"+"<&lt;songoaican&lt;&lt;"sqrt("&lt;&lt;sotrongcan&lt;&lt;")"&lt;&lt;"/"<&lt;mauso&lt;&lt;endl;
    cout<<"x2="<<-b<<"-"<&lt;songoaican&lt;&lt;"sqrt("&lt;&lt;sotrongcan&lt;&lt;")"&lt;&lt;"/"<&lt;mauso&lt;&lt;endl;
    xapxix = (-b2+sqrt(deltabandau));
    xapxix2 = (-b2-sqrt(deltabandau));
    cout<<"gia tri cua x1 xap xi bang:"<&lt;fixed&lt;&lt;setprecision(4)&lt;&lt;xapxix/mausobandau<&lt;endl;
    cout<<"gia tri cua x2 xap xi bang:"<&lt;fixed&lt;&lt;setprecision(4)&lt;&lt;xapxix2/mausobandau;
    }
}
if (delta == 0) {
    a = a*2;
    int gcdkt = __gcd(a,b);
    a = a/gcdkt;
    b = -b/gcdkt;
    cout<<"x1=x2="<&lt;b&lt;&lt;"/"<&lt;a;
}
if (delta < 0) {
    cout<<"PHUONG TRINH VO NGHIEM";
}

} int main() { cout<<"caculator tinh he phuong trinh va phuong trinh bac 2"<<endl; cout<<"made by qixi :)"<<endl; cout<<"luu y: co the chuong trinh tinh sai ket qua mong cac ban thong cam :,) "<<endl; cout<<"he phuong trinh chon 1"<<endl; cout<<"phuong trinh bac 2 chon 2"<<endl; cout<<"phuong trinh bac 1 chon 3"<<endl; int choose,chon,d; d = 0; chon = 0; while (chon != 1) { cout<<"enter number here =>"<<endl; cin>>choose; if (choose == 1) { hpt(); chon = 1; break; } if (choose == 2) { ptbac2(); chon = 1; break; } if (choose == 3) { ptbac1(); chon = 1; break; } if (choose != 2 || choose !=1 || choose !=3) { d++; if (d<10) { cout<<"chon lai di bruh ._. "<<endl; }

    if (d >=10) {
        cout<<"dua khong vui dau chon lai di >:( "<&lt;endl;
    }
    if (d>=15) {
        cout<<"eo tinh cho nua bye fuck you"<&lt;endl;
        return 0;
    }
}
}
return 0;

}

Huy hiệu

Người dùng này không có huy hiệu nào.

«    »
CN
T2
T3
T4
T5
T6
T7
Ít
Nhiều

dựa trên VNOJ | Github | Facebook
Hướng dẫn cho bạn mới LCOJ Báo cáo vấn đề Tài khoản AI cho dev Behigen Tài chính cá nhân Behivest Tài liệu kỹ thuật LCOJ

Ủng hộ Luyện Code Online

Cảm ơn bạn đã quan tâm ủng hộ chúng tôi!

Khoản ủng hộ của bạn sẽ được sử dụng để:

  • Duy trì và nâng cấp máy chủ
  • Mở rộng bộ đề bài và tài liệu học tập
  • Cải thiện trải nghiệm người dùng
Mã QR

Quét mã QR để chuyển khoản

Cảm ơn bạn rất nhiều vì sự ủng hộ! ❤️