• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            Uriel's Corner

            Research Associate @ Harvard University / Research Interests: Computer Vision, Biomedical Image Analysis, Machine Learning
            posts - 0, comments - 50, trackbacks - 0, articles - 594
            還行,一般難度。。不過第二題死活AC不能啊。。

            1. 二次方程計算器
                感覺數(shù)據(jù)很弱。。各種BT情況(空格,X*X之類的case等。。)都沒有考慮,出了sample就過了。。
                話說代碼長度恰好2000B。。。- -||
            //2011年上海交通大學計算機研究生機題 二次方程計算器
            #include<ctype.h>
            #include
            <math.h>
            #include
            <stdio.h>
            #include
            <stdlib.h>
            #include
            <string.h>
            #include
            <algorithm>
            using namespace std;

            double a, b, c, t1, t2;
            char s[1010];

            int main() {
                
            int i, fg;
                
            double tp;
                
            while(gets(s) != NULL) {
                    fg 
            = 0;
                    a 
            = b = c = tp = 0.0;
                    
            for(i = 0; s[i]; ++i) {
                        
            if(isdigit(s[i])) {
                            tp 
            = 0.0;
                            
            while(s[i] && isdigit(s[i])) {
                                tp 
            = tp * 10 + s[i] - '0';
                                
            ++i;
                            }
                            
            if(s[i] && (s[i] == 'x' || s[i] == 'X')) {
                                
            --i; continue;
                            }
                            
            else {
                                
            --i;
                                
            if(fg) c += -tp;
                                
            else
                                    c 
            += tp;
                            }
                        }
                        
            else if(s[i] == '-') {
                            
            ++i;
                            
            if(isdigit(s[i])) {
                                tp 
            = 0.0;
                                
            while(s[i] && isdigit(s[i])) {
                                    tp 
            = tp * 10 + s[i] - '0';
                                    
            ++i;
                                }
                                tp 
            *= -1;
                                
            if(s[i] && (s[i] == 'x' || s[i] == 'X')) {
                                    
            --i; continue;
                                }
                                
            else {
                                    
            --i;
                                    
            if(fg) c += -tp;
                                    
            else
                                        c 
            += tp;
                                }
                            }
                            
            else {
                                tp 
            = -1;
                                
            --i;
                            }
                        }
                        
            else if(s[i] == '+'continue;
                        
            else {
                            
            if(s[i] == '=') {
                                fg 
            = 1;
                                
            continue;
                            }
                            
            else if(s[i] == 'x' || s[i] == 'X') {
                                
            ++i;
                                
            if(s[i] == '^') {
                                    
            ++i;
                                    
            if(tp == 0) tp = 1;
                                    
            if(fg) a += -tp;
                                    
            else
                                        a 
            += tp;
                                }
                                
            else {
                                    
            --i;
                                    
            if(tp == 0) tp = 1;
                                    
            if(fg) b += -tp;
                                    
            else
                                        b 
            += tp;
                                }
                            }
                            tp 
            = 0.0;
                        }
                    }
                    
            //printf("a=%f b=%f c=%f\n", a, b, c);
                    if(b * b >= 4 * a * c) {
                        t1 
            = (-- sqrt(b * b - 4 * a * c)) / (2 * a);
                        t2 
            = (-+ sqrt(b * b - 4 * a * c)) / (2 * a);
                        printf(
            "%.2lf %.2lf\n", t1, t2);
                    }
                    
            else
                        puts(
            "No Solution");
                }
                
            return 0;
            }


            2. 整除問題
                WA到死啊。。
                我的思路是找出500以內(nèi)所有質(zhì)數(shù),預處理出從1到1000每個數(shù)的階乘的各質(zhì)因子的個數(shù),然后對于每個case,找出n!的各質(zhì)因子個數(shù),計算a的各質(zhì)因子個數(shù),看n!的各質(zhì)因子數(shù)能滿足幾個a的需要,此即為k值。。不知思路有啥問題沒。。
                想想要是到時候機試就這么1,2道題,萬一哪道卡死就悲劇了。。(最近幾天要多拜拜代碼之神。。保佑我別卡題。。= =)
                WA的代碼先曬這里。。路過的大牛不吝賜教啊。。Orz
            //2011年上海交通大學計算機研究生機題 整除問題
            #include<stdio.h>
            #include
            <stdlib.h>
            #include
            <string.h>
            #define INF 0x3f3f3f3f
             
            int pr[] = {235711131719232931374143475359
                
            6167717379838997101103107109113127131
                
            137139149151157163167173179181191193197
                
            199211223227229233239241251257263269271
                
            277281283293307311313317331337347349353
                
            359367373379383389397401409419421431433
                
            439443449457461463467479487491499};
            int nt[40], n, a, pre[1010][100], fg[100];
             
            int main() {
                
            int i, j, k, tp, t;
                
            for(i = 0; i < 95++i) pre[1][i] = 0;
                
            for(i = 2; i <= 1000++i) {
                    t 
            = i;
                    
            for(j = 0; j < 95++j) {
                        pre[i][j] 
            = pre[i - 1][j];
                        
            if(t % pr[j] == 0) {
                            
            while(t % pr[j] == 0) {
                                t 
            /= pr[j];
                                pre[i][j]
            ++;
                            }
                        }
                    }
                }
                scanf(
            "%d %d"&n, &a);
                memset(fg, 
            0sizeof(fg));
                
            for(i = 0; i < 95++i) {
                    
            if(a < pr[i]) break;
                    
            if(a % pr[i] == 0) {
                        
            while(a % pr[i] == 0) {
                            a 
            /= pr[i];
                            fg[i]
            ++;
                        }
                    }
                }
                k 
            = INF;
                
            for(i = 0; i < 95++i) {
                    
            if(!fg[i]) continue;
                    tp 
            = pre[n][i] / fg[i];
                    
            if(tp < k) {
                        k 
            = tp;
                    }
                }
                printf(
            "%d\n", k);
                
            return 0;
            }
            /**************************************************************
                Problem: 1104
                User: Uriel
                Language: C++
                Result: Wrong Answer
            ***************************************************************
            */
            一本大道久久东京热无码AV| 精品久久久无码21p发布| 久久九九免费高清视频| 久久亚洲国产精品五月天婷| 中文字幕亚洲综合久久菠萝蜜| 精品国产乱码久久久久久呢| 777久久精品一区二区三区无码| 亚洲国产精品综合久久一线| 久久偷看各类wc女厕嘘嘘| 日日狠狠久久偷偷色综合免费| 人妻丰满AV无码久久不卡| 久久综合狠狠综合久久97色| 国产精品一区二区久久不卡| 伊人久久大香线蕉综合热线| 亚洲国产成人久久精品影视| 久久影院综合精品| 久久亚洲国产精品成人AV秋霞| 91亚洲国产成人久久精品| 日韩精品久久无码中文字幕| 久久中文字幕精品| 国产精品美女久久久久av爽| 国产精品久久久久9999| 久久人爽人人爽人人片AV| 亚洲人成无码www久久久| 精品多毛少妇人妻AV免费久久 | 久久夜色精品国产| 久久亚洲精品视频| 久久99热只有频精品8| 久久国产免费直播| 热99RE久久精品这里都是精品免费| 久久久久亚洲精品天堂久久久久久| 久久亚洲精品视频| 中文字幕成人精品久久不卡| 日韩精品久久久久久| 久久亚洲高清观看| a级毛片无码兔费真人久久| 久久精品免费一区二区三区| 久久99国产精品久久99果冻传媒| 99久久婷婷国产综合亚洲| 91精品国产综合久久久久久| 99久久精品国产麻豆|