• <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
            還比較水。。但是罰時(shí)茫茫多。。。= =

            1. 找位置
                nt數(shù)組忘記初始化。。OLE*1。。。
                PS: 2012.03.05 updated!! 沒(méi)有重復(fù)出現(xiàn)的字母不需要輸出!!
            //2005年華中科技大學(xué)計(jì)算機(jī)保研機(jī)試題 找位置
            #include<stdio.h>
            #include
            <stdlib.h>
            #include
            <string.h>

            int mk[400],fg[400][100], nt[400];
            char s[200];

            int main() {
                
            int i, j;
                
            while(gets(s) != NULL) {
                    memset(mk, 
            0sizeof(mk));
                    memset(fg, 
            -1sizeof(fg));
                    memset(nt, 
            0sizeof(nt));
                    
            for(i = 0; s[i]; ++i) {
                        
            if(mk[s[i]]) fg[s[i]][nt[s[i]]++= i;
                        
            else {
                            mk[s[i]] 
            = 1;
                            fg[s[i]][nt[s[i]]
            ++= i;
                        }
                    }
                    memset(mk, 
            0sizeof(mk));
                    
            for(i = 0; s[i]; ++i) {
                        
            if(!mk[s[i]] && nt[s[i]] > 1) {
                            printf(
            "%c:%d", s[i], fg[s[i]][0]);
                            
            for(j = 1; j < nt[s[i]]; ++j) printf(",%c:%d", s[i], fg[s[i]][j]);
                            puts(
            "");
                            mk[s[i]] 
            = 1;
                        }
                    }
                }
                
            return 0;
            }
            /************************************************************** 
                Problem: 1199 
                User: Uriel 
                Language: C++ 
                Result: Accepted 
                Time:30 ms 
                Memory:1172 kb 
            ***************************************************************
            */


            2. 最大的兩個(gè)數(shù)
                看錯(cuò)題。。WA*4。。
            //2005年華中科技大學(xué)計(jì)算機(jī)保研機(jī)試題 最大的兩個(gè)數(shù) 
            #include<stdio.h> 
            #include
            <stdlib.h> 
            #include
            <string.h> 
            #define INF 0x3f3f3f3f 
              
            int t[4][5], mx[5][2], pos[5][2]; 
              
            int main() 
                
            int i, j, cse, fg; 
                
            while(~scanf("%d"&cse)) 
                    
            while(cse--
                        
            for(i = 0; i < 5++i) 
                            mx[i][
            0= mx[i][1= -INF; 
                        }
             
                        
            for(i = 0; i < 4++i) 
                            
            for(j = 0; j < 5++j) 
                                scanf(
            "%d"&t[i][j]); 
                                
            if(t[i][j] > mx[j][0]) 
                                    mx[j][
            1= mx[j][0]; 
                                    mx[j][
            0= t[i][j]; 
                                }
             
                                
            else if(t[i][j] > mx[j][1]) mx[j][1= t[i][j]; 
                            }
             
                        }
             
                        
            for(i = 0; i < 5++i) 
                            
            for(j = 0; j < 4++j) 
                                
            if(t[j][i] == mx[i][0]) 
                                    fg 
            = 0
                                    pos[i][
            0= j; 
                                    
            break
                                }
             
                                
            else if(t[j][i] == mx[i][1]) 
                                    fg 
            = 1
                                    pos[i][
            0= j; 
                                    
            break
                                }
             
                            }
             
                            
            for(++j; j < 4++j) 
                                
            if(t[j][i] == mx[i][0&& fg) 
                                    pos[i][
            1= j; 
                                    
            break
                                }
             
                                
            else if(t[j][i] == mx[i][1&& !fg) 
                                    pos[i][
            1= j; 
                                    
            break
                                }
             
                            }
             
                        }
             
                        
            for(i = 0; i < 5++i) printf("%d ", t[pos[i][0]][i]); 
                        puts(
            ""); 
                        
            for(i = 0; i < 5++i) printf("%d ", t[pos[i][1]][i]); 
                        puts(
            ""); 
                    }
             
                }
             
                
            return 0
            }
             
            /************************************************************** 
                Problem: 1200 
                User: Uriel 
                Language: C++ 
                Result: Accepted 
                Time:20 ms 
                Memory:1012 kb 
            ***************************************************************
            */


            3. 二叉排序樹(shù)
                貌似有0的情況。。一開(kāi)始若結(jié)點(diǎn)數(shù)為0直接結(jié)束就TLE,改為結(jié)點(diǎn)數(shù)為0就輸出空行就AC
            //2005年華中科技大學(xué)計(jì)算機(jī)保研機(jī)試題 二叉排序樹(shù)  
            #include<stdio.h> 
            #include
            <stdlib.h> 
            #include
            <string.h> 
              
            struct node 
                
            int l, r, s; 
            }
            p[1000]; 
              
            int n; 
              
            int ext(int rt, int x) 
                
            if(rt == -1return 0
                
            else if(p[rt].s == x) return 1
                
            else if(x < p[rt].s) return ext(p[rt].l, x); 
                
            else
                    
            return ext(p[rt].r, x); 
            }
             
              
            void ins(int idx, int rt, int x) 
                
            if(x < p[rt].s) 
                    
            if(~p[rt].l) ins(idx, p[rt].l, x); 
                    
            else 
                        p[rt].l 
            = idx; 
                        p[idx].l 
            = p[idx].r = -1
                        p[idx].s 
            = x; 
                    }
             
                }
             
                
            else if(x > p[rt].s) 
                    
            if(~p[rt].r) ins(idx, p[rt].r, x); 
                    
            else 
                        p[rt].r 
            = idx; 
                        p[idx].l 
            = p[idx].r = -1
                        p[idx].s 
            = x; 
                    }
             
                }
             
            }
             
              
            void preorder(int rt) 
                
            if(~rt) 
                    printf(
            "%d ", p[rt].s); 
                    preorder(p[rt].l); 
                    preorder(p[rt].r); 
                }
             
            }
             
              
            void inorder(int rt) 
                
            if(~rt) 
                    inorder(p[rt].l); 
                    printf(
            "%d ", p[rt].s); 
                    inorder(p[rt].r); 
                }
             
            }
             
              
            void postorder(int rt) 
                
            if(~rt) 
                    postorder(p[rt].l); 
                    postorder(p[rt].r); 
                    printf(
            "%d ", p[rt].s); 
                }
             
            }
             
              
            int main() 
                
            int i, a; 
                
            while(~scanf("%d"&n)) 
                    
            if(!n) 
                        puts(
            ""); 
                        
            continue
                    }
             
                    
            for(i = 0; i <= n; ++i) p[i].l = p[i].r = -1
                    scanf(
            "%d"&a); 
                    p[
            0].s = a; 
                    
            for(i = 1; i < n; ++i) 
                        scanf(
            "%d"&a); 
                        
            if(ext(0, a)) continue
                        
            else
                            ins(i, 
            0, a); 
                    }
             
                    preorder(
            0); 
                    puts(
            ""); 
                    inorder(
            0); 
                    puts(
            ""); 
                    postorder(
            0); 
                    puts(
            ""); 
                }
             
                
            return 0
            }
             
            /************************************************************** 
                Problem: 1201 
                User: Uriel 
                Language: C++ 
                Result: Accepted 
                Time:100 ms 
                Memory:1024 kb 
            ***************************************************************
            */


            4. 排序
                大水不解釋
            //2006年華中科技大學(xué)計(jì)算機(jī)保研機(jī)試題 二叉排序樹(shù)  
            #include<stdio.h> 
            #include
            <stdlib.h> 
            #include
            <string.h> 
            #include
            <algorithm> 
            using namespace std; 
              
            int a[120], n; 
              
            int main() 
                
            int i; 
                
            while(~scanf("%d"&n)) 
                    
            for(i = 0; i < n; ++i) 
                        scanf(
            "%d"&a[i]); 
                    }
             
                    sort(a, a 
            + n); 
                    
            for(i = 0; i < n; ++i) printf("%d ", a[i]); 
                    puts(
            ""); 
                }
             
                
            return 0
            }
             
            /************************************************************** 
                Problem: 1202 
                User: Uriel 
                Language: C++ 
                Result: Accepted 
                Time:40 ms 
                Memory:1012 kb 
            ***************************************************************
            */


            5. IP地址
                大水不解釋
            //2006年華中科技大學(xué)計(jì)算機(jī)保研機(jī)試題 IP地址  
            #include<stdio.h> 
            #include
            <stdlib.h> 
            #include
            <string.h> 
              
            int main() 
                
            int cse, a, b, c, d; 
                scanf(
            "%d"&cse); 
                
            while(cse--
                    scanf(
            "%d.%d.%d.%d"&a, &b, &c, &d); 
                    
            if(a >= 0 && a <= 255 && b >= 0 && b <= 255 && c >= 0 && c <= 255 && d >= 0 && d <= 255) puts("Yes!"); 
                    
            else
                        puts(
            "No!"); 
                }
             
                
            return 0
            }
             
            /************************************************************** 
                Problem: 1203 
                User: Uriel 
                Language: C++ 
                Result: Accepted 
                Time:10 ms 
                Memory:1012 kb 
            ***************************************************************
            */

            Feedback

            # re: 華中科技大學(xué)計(jì)算機(jī)研究生機(jī)試題-2005,2006年[未登錄](méi)  回復(fù)  更多評(píng)論   

            2012-03-05 19:40 by ZAKIR
            同學(xué),貌似1199找位置那個(gè)題rejudge了,你的代碼好像不行哦。
            話(huà)說(shuō),那題題意不清啊,大小寫(xiě)字母區(qū)分不?

            # re: 華中科技大學(xué)計(jì)算機(jī)研究生機(jī)試題-2005,2006年  回復(fù)  更多評(píng)論   

            2012-03-05 21:44 by Uriel
            @ZAKIR
            是的,Rejudge了,我已經(jīng)update了,現(xiàn)在這個(gè)代碼可以AC
            粉嫩小泬无遮挡久久久久久| 免费一级欧美大片久久网| 久久国产AVJUST麻豆| 国产精品VIDEOSSEX久久发布| 久久久久久国产精品免费无码| 久久精品亚洲AV久久久无码| 久久免费的精品国产V∧| 日韩人妻无码精品久久免费一 | 国产精品美女久久久网AV| 97久久精品人妻人人搡人人玩| 久久精品国产亚洲AV麻豆网站| 欧洲人妻丰满av无码久久不卡| 久久亚洲AV成人无码国产| 国产精品久久久久久影院| 久久精品国产亚洲av瑜伽| 欧美一级久久久久久久大片| 国内高清久久久久久| 91精品国产9l久久久久| 成人a毛片久久免费播放| 免费无码国产欧美久久18| 亚洲AV无码一区东京热久久| 狠狠狠色丁香婷婷综合久久俺| 色综合久久最新中文字幕| 亚洲国产日韩综合久久精品| 久久99精品久久久久久久久久| 伊人久久综在合线亚洲2019| 一级A毛片免费观看久久精品| 久久精品国产亚洲AV电影| 久久国产影院| 久久精品成人免费看| 久久精品国产乱子伦| 国产精品综合久久第一页| 久久精品国产99国产精品亚洲| 香港aa三级久久三级| 国产aⅴ激情无码久久| 久久WWW免费人成—看片| 久久精品蜜芽亚洲国产AV| 久久久久亚洲国产| segui久久国产精品| 精品久久久久久亚洲精品| 香蕉久久av一区二区三区|