ITÊýÂë ¹ºÎï ÍøÖ· Í·Ìõ Èí¼þ ÈÕÀú ÔĶÁ ͼÊé¹Ý
TxTС˵ÔĶÁÆ÷
¡ýÓïÒôÔĶÁ,С˵ÏÂÔØ,¹ÅµäÎÄѧ¡ý
ͼƬÅúÁ¿ÏÂÔØÆ÷
¡ýÅúÁ¿ÏÂÔØͼƬ,ÃÀŮͼ¿â¡ý
ͼƬ×Ô¶¯²¥·ÅÆ÷
¡ýͼƬ×Ô¶¯²¥·ÅÆ÷¡ý
Ò»¼üÇå³ýÀ¬»ø
¡ýÇáÇáÒ»µã,Çå³ýϵͳÀ¬»ø¡ý
¿ª·¢: C++֪ʶ¿â Java֪ʶ¿â JavaScript Python PHP֪ʶ¿â È˹¤ÖÇÄÜ Çø¿éÁ´ ´óÊý¾Ý Òƶ¯¿ª·¢ ǶÈëʽ ¿ª·¢¹¤¾ß Êý¾Ý½á¹¹ÓëËã·¨ ¿ª·¢²âÊÔ ÓÎÏ·¿ª·¢ ÍøÂçЭÒé ϵͳÔËά
½Ì³Ì: HTML½Ì³Ì CSS½Ì³Ì JavaScript½Ì³Ì GoÓïÑÔ½Ì³Ì JQuery½Ì³Ì VUE½Ì³Ì VUE3½Ì³Ì Bootstrap½Ì³Ì SQLÊý¾Ý¿â½Ì³Ì CÓïÑÔ½Ì³Ì C++½Ì³Ì Java½Ì³Ì Python½Ì³Ì Python3½Ì³Ì C#½Ì³Ì
ÊýÂë: µçÄÔ ±Ê¼Ç±¾ ÏÔ¿¨ ÏÔʾÆ÷ ¹Ì̬ӲÅÌ Ó²ÅÌ ¶ú»ú ÊÖ»ú iphone vivo oppo СÃ× »ªÎª µ¥·´ ×°»ú ͼÀ­¶¡
 
   -> Êý¾Ý½á¹¹ÓëËã·¨ -> doubleÀàÐÍ´òÓ¡½á¹ûÒ»Öµ«ÏµÍ³Åж¨²»Ò»ÖµÄÎÊÌâ -> ÕýÎÄÔĶÁ

[Êý¾Ý½á¹¹ÓëËã·¨]doubleÀàÐÍ´òÓ¡½á¹ûÒ»Öµ«ÏµÍ³Åж¨²»Ò»ÖµÄÎÊÌâ

¼ÙÉè´æÔÚÁ½¸öÀíÂÛ½á¹ûÒ»ÖµĹ«Ê½bºÍb1:

bºÍb1µÄ¼ÆË㷽ʽÀíÂÛÉϼÆËãµÃ³öµÄ½á¹ûÊÇÒ»ÑùµÄ,±àÒëÆ÷´òÓ¡³öÀ´ÈâÑÛ¿´Ò²ÊÇÒ»ÑùµÄ,ϵͳÅж¨²»Ò»ÑùÔ­ÒòÈçÏÂ:
¼´Ê¹doubleÓÐןܸߵľ«¶È(64λ),µ«ÊÇ»úÆ÷¶Ô×îºóһλµÄ´¦Àí±Ø¶¨ÊÇËÄÉáÎåÈëµÄ


ÈçÓöµ½ÎÞÏÞÑ­»·orÎÞÏÞ²»Ñ­»·Ð¡ÊýÕâÑùµÄ¼ÆËã½á¹û,Èô½«¸Ã½á¹û±£´æÔÚij¸ödouble±äÁ¿ÖÐÓÃÓÚºóÐø¼ÆËã,¼ÆËã½á¹ûµÄÅжϿÉÄÜ»á³ö´í¡£

ÄÇôÓÐÒÔϼ¸ÖÖ´¦Àí·½Ê½
(1)½«doubleÇ¿ÖÆת»»Îªstring,±£Áô¾«¶ÈÔÚÊ®½øÖÆ0.000001
(2)¼ì²â²îÖµ,µ±²îֵСÓÚ0.000001ʱÈÏΪһÖÂ
(3)ÍƼöµÄ°ì·¨:ÔÚ¼ÆË㹫ʽÖб£Ö¤²»°üº¬Ä³¸ödoubleÐ͵ıäÁ¿k(¸Ãk¿ÉÄÜÊǾ­¹ýϵͳĩβËÄÉáÎåÈëÈ¡ÖµµÄÎÞÏÞСÊý)
ÔÚÕâÀï²åÈëͼƬÃèÊö


        ¡¾½«ÏÂÃæµÄ´úÂë±£´æΪcppÎļþ²¢ÔËÐпÉÒÔ¿´µ½ÕâÖÖ³ö´íµÄÇé¿ö¡¿
/*

¡¾ÎÊÌâÃèÊö¡¿
ÔÚƽÃæÖ±½Ç×ø±êϵÖÐ,Á½µã¿ÉÒÔÈ·¶¨Ò»ÌõÖ±Ïß¡£Èç¹ûÓжàµãÔÚÒ»ÌõÖ±ÏßÉÏ,ÄÇôÕâЩµãÖÐÈÎÒâÁ½µãÈ·¶¨µÄÖ±ÏßÊÇͬһÌõ¡£
¸ø¶¨Æ½ÃæÉÏ2x3¸öÕûµã{(xv)0¡Üx<20¡Ü§å<3x€Zy€Z},¼´ºá×ø±êÊÇ0µ½1(°üº¬0ºÍ1)Ö®¼äµÄÕûÊý¡¢×Ý×ø±êÊÇ0µ½2(°üº¬0ºÍ2)Ö®¼äµÄÕûÊýµÄµã¡£
ÕâЩµãÒ»¹²È·¶¨ÁË11Ìõ²»Í¬µÄÖ±Ïß¡£

¸ø¶¨Æ½ÃæÉÏ20x21¸öÕûµã1(xy)0¡Üx<200¡Ü§å<21x€Z,y€Z},¼´ºá×ø±êÊÇ0µ½19(°üº¬0ºÍ19)Ö®¼äµÄÕûÊý¡¢×Ý×ø±êÊÇ0µ½20(°üº¬0ºÍ20)Ö®¼äµÄÕûÊýµÄµã¡£
ÇëÎÊÕâЩµãÒ»¹²È·¶¨Á˶àÉÙÌõ²»Í¬µÄÖ±Ïß ?

*/
# include<iostream>
# include<map>
# include<set>
# include<string>
#define row 5
#define col 3
using namespace std;

int main() {
    map<pair<double, double>, int> m = {};
    int ans = 0;
    for (int x1 = 0; x1 < row; x1++)
        for (int y1 = 0; y1 < col; y1++)
            for (int x2 = 0; x2 < row; x2++)
                for (int y2 = 0; y2 < col; y2++) {
                    if (x1 == x2 || y1 == y2)   continue;
                    
                    double k = 1.0*(y2 - y1) / (x2 - x1)*1.0;
                    double b = (y1 - k * x1);
                    
                    double k1 = (y1 - y2) * 1.0 / (x1 - x2);
                    double b1 = ((x2 * y1 - x1 * y2) * 1.0) / ((x2 - x1) * 1.0);

                    /*
                    ´æÔÚÃ÷ÏÔµÄÎÊÌâ,bºÍb1µÄ¼ÆË㷽ʽÀíÂÛÉϼÆËãµÃ³öµÄ½á¹ûÊÇÒ»ÑùµÄ,´òÓ¡³öÀ´ÈâÑÛ¿´Ò²ÊÇÒ»ÑùµÄ,µ«ÊÇϵͳÅж¨²»Ò»Ñù:
                    ¼´Ê¹doubleÓÐןܸߵľ«¶È(64λ),µ«ÊÇ»úÆ÷¶Ô×îºóһλµÄ´¦Àí±Ø¶¨ÊÇËÄÉáÎåÈëµÄ;
                    ÈçÓöµ½ÎÞÏÞÑ­»·orÎÞÏÞ²»Ñ­»·Ð¡ÊýÕâÑùµÄ¼ÆËã½á¹û,Èô½«¸Ã½á¹û±£´æÔÚij¸ödouble±äÁ¿ÖÐÓÃÓÚºóÐø¼ÆËã,¼ÆËã½á¹ûµÄÅжϿÉÄÜ»á³ö´í¡£
                    ¡¾ÔËÐиôúÂë¿ÉÒÔ¿´µ½ÕâÖÖ³ö´íµÄÇé¿ö¡¿
                    ÄÇôÓÐÒÔÏÂÁ½ÖÖ´¦Àí·½Ê½:
                    (1)½«doubleÇ¿ÖÆת»»Îªstring,±£Áô¾«¶ÈÔÚÊ®½øÖÆ0.000001
                    (2)¼ì²â²îÖµ,µ±²îֵСÓÚ0.000001ʱÈÏΪһÖÂ
                    (3)ÍƼöµÄ°ì·¨,ÔÚ¼ÆË㹫ʽÖб£Ö¤²»°üº¬Ä³¸ödoubleÐ͵ıäÁ¿k(¸Ãk¿ÉÄÜÊǾ­¹ýϵͳĩβËÄÉáÎåÈëÈ¡ÖµµÄÎÞÏÞСÊý)
                    */
                  
                    if (b != b1) {
                        printf("µãA1:(%d,%d),\tµãA2:(%d,%d)\n", x1, y1, x2, y2);
                        printf("b¹«Ê½¼ÆËã³öµÄ½Ø¾à:\tÊ®Áù½øÖÆ:%x\t¸¡µãÐÍ:%lf\n", b,b);
                        printf("b1¹«Ê½¼ÆËã³öµÄ½Ø¾à:\tÊ®Áù½øÖÆ:%x\t¸¡µãÐÍ:%lf\n", b1,b1);
                        string notice = b == b1 ? "b==b1" : "b!=b1";
                        cout << notice << endl;
                        cout << " ½«Æäת»»³ÉstringÔÙ×ö±È½Ï: " << endl;
                        string str = to_string(b);
                        string str1 = to_string(b1);
                        cout << "str_b:\t" << str << endl;
                        cout << "str_b1:\t" << str1 << endl;
                        string note = str == str1 ? "str_b==str_b1" : "str_b!=str_b1";
                        cout << note << endl << endl;

                    }
               
                    if (m[{k, b}] == 0) {
                        m[{k, b}] = 1;
                       //printf("a:(%d,%d),b:(%d,%d) ¡ª¡ª¡ª¡ª бÂÊ:%.2f\t½Ø¾à:%.2f\n\n", x1,y1,x2,y2,k,b);
                        ans++;
                    }
                }

    cout << "ÓÉÓÚÉÏÊöÎÊÌâµ¼ÖµĽá¹û´íÎó:" << ans + row + col << endl;
    cout << "__________________________________________________________________\n\n\n" << endl;

    /*
     ÏÂÃæÊÇÕýÈ·µÄ¼ÆË㷽ʽ
    */
    set<pair<double, double> >a;            // Ö±½ÓʹÓÃsetÈ¥ÖØ
        for (int x1 = 0; x1 < row; x1++) {
            for (int y1 = 0; y1 < col; y1++) {
                for (int x2 = 0; x2 < row;x2++) {
                    for (int y2 = 0; y2 < col;y2++){
                        if (x1 == x2 ) {    //±ÜÃâбÂʲ»´æÔÚ,Ò²¿ÉÒÔÔÚÌõ¼þÖмÓÉÏ || y1 == y2 ,µ«½á¹ûÒª¼ÓÉÏcol
                            continue;
                        }
                        double k = (y1 - y2) * 1.0 / (x1 - x2);
                        double b = ((x2 * y1 - x1 * y2) * 1.0) / ((x2 - x1) * 1.0);     //²»ÔÚ¼ÆËãÖаüº¬doubleÀàÐ͵ıäÁ¿
                        a.insert(make_pair(k, b));
                    }
                }
            }
        }
        cout << "ÏßÌõµÄÕæÕý¸öÊý" << a.size() + row << endl;
    return 0;
}

  Êý¾Ý½á¹¹ÓëËã·¨ ×îÐÂÎÄÕÂ
¡¾Á¦¿Û106¡¿ ´ÓÖÐÐòÓëºóÐø±éÀúÐòÁй¹Ôì¶þ²æ
leetcode 322 ÁãÇ®¶Ò»»
¹þÏ£µÄÓ¦Ó㺺£Á¿Êý¾Ý´¦Àí
¶¯Ì¬¹æ»®|×î¶ÌHamilton·¾¶
»ªÎª»úÊÔ_HJ41 ³ÆíÀÂ롾Öеȡ¿¡¾menset¡¿¡¾
¡¾CÓëÊý¾Ý½á¹¹¡¿¡ª¡ªº®¼ÙÌá¸ßÿÈÕÁ·Ï°Day1
»ù´¡Ëã·¨¡ª¡ª¶ÑÅÅÐò
2023ÍõµÀÊý¾Ý½á¹¹ÏßÐÔ±í--µ¥Á´±í¿ÎºóÏ°Ìⲿ
LeetCode Ö® ·´×ªÁ´±íµÄÒ»²¿·Ö
¡¾Ìâ½â¡¿lintcode±ØË¢50Ì⣼ÓÐЧµÄÀ¨ºÅÐòÁÐ
ÉÏһƪÎÄÕ      ÏÂһƪÎÄÕ      ²é¿´ËùÓÐÎÄÕÂ
¼Ó:2022-03-06 13:22:01  ¸ü:2022-03-06 13:23:03 
 
¿ª·¢: C++֪ʶ¿â Java֪ʶ¿â JavaScript Python PHP֪ʶ¿â È˹¤ÖÇÄÜ Çø¿éÁ´ ´óÊý¾Ý Òƶ¯¿ª·¢ ǶÈëʽ ¿ª·¢¹¤¾ß Êý¾Ý½á¹¹ÓëËã·¨ ¿ª·¢²âÊÔ ÓÎÏ·¿ª·¢ ÍøÂçЭÒé ϵͳÔËά
½Ì³Ì: HTML½Ì³Ì CSS½Ì³Ì JavaScript½Ì³Ì GoÓïÑÔ½Ì³Ì JQuery½Ì³Ì VUE½Ì³Ì VUE3½Ì³Ì Bootstrap½Ì³Ì SQLÊý¾Ý¿â½Ì³Ì CÓïÑÔ½Ì³Ì C++½Ì³Ì Java½Ì³Ì Python½Ì³Ì Python3½Ì³Ì C#½Ì³Ì
ÊýÂë: µçÄÔ ±Ê¼Ç±¾ ÏÔ¿¨ ÏÔʾÆ÷ ¹Ì̬ӲÅÌ Ó²ÅÌ ¶ú»ú ÊÖ»ú iphone vivo oppo СÃ× »ªÎª µ¥·´ ×°»ú ͼÀ­¶¡

360ͼÊé¹Ý ¹ºÎï Èý·á¿Æ¼¼ ÔĶÁÍø ÈÕÀú ÍòÄêÀú 2024Äê11ÈÕÀú -2024/11/28 23:45:56-

ͼƬ×Ô¶¯²¥·ÅÆ÷
¡ýͼƬ×Ô¶¯²¥·ÅÆ÷¡ý
TxTС˵ÔĶÁÆ÷
¡ýÓïÒôÔĶÁ,С˵ÏÂÔØ,¹ÅµäÎÄѧ¡ý
Ò»¼üÇå³ýÀ¬»ø
¡ýÇáÇáÒ»µã,Çå³ýϵͳÀ¬»ø¡ý
ͼƬÅúÁ¿ÏÂÔØÆ÷
¡ýÅúÁ¿ÏÂÔØͼƬ,ÃÀŮͼ¿â¡ý
  ÍøÕ¾ÁªÏµ: qq:121756557 email:121756557@qq.com  ITÊýÂë