• <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
            ***************************************************************
            */
            精品久久久久久久久免费影院 | 国产精品免费久久久久影院| 久久久久久九九99精品| 欧美久久精品一级c片片| 久久精品成人欧美大片| 欧洲精品久久久av无码电影| 久久国产乱子伦精品免费强| 久久久久亚洲AV无码观看| 国产日韩久久免费影院| 77777亚洲午夜久久多人| 国产成人99久久亚洲综合精品| 久久天天躁夜夜躁狠狠躁2022| 国产免费久久精品丫丫| 成人妇女免费播放久久久| 色综合久久夜色精品国产| 情人伊人久久综合亚洲| 精品久久久久久无码中文字幕一区| 色婷婷噜噜久久国产精品12p| 91精品国产色综合久久| 午夜精品久久久久久毛片| 中文字幕无码久久久| 久久久精品久久久久久| 99国内精品久久久久久久| av无码久久久久不卡免费网站 | 久久无码高潮喷水| 久久影视综合亚洲| 久久久WWW成人免费毛片| 国产午夜精品久久久久九九电影| 久久国产色AV免费观看| 久久99国产综合精品女同| 一本色道久久99一综合| 一本色道久久综合亚洲精品| 久久综合久久自在自线精品自| 99久久精品国产一区二区| 国产精品久久久久久久人人看 | 国产激情久久久久影院| 国产精品成人无码久久久久久 | 亚洲国产成人精品久久久国产成人一区二区三区综 | 国产亚洲精久久久久久无码77777| 色综合久久天天综线观看| 久久国产亚洲精品|