• <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
            久久大香香蕉国产| 国产精品久久久久久久久鸭| 久久久久女教师免费一区| 人妻少妇精品久久| 久久国产劲爆AV内射—百度| 久久久久亚洲AV片无码下载蜜桃| 精品综合久久久久久97超人 | 久久精品免费一区二区| 嫩草伊人久久精品少妇AV| 国产午夜精品久久久久九九| 久久综合九色综合网站| 九九久久99综合一区二区| 久久精品人妻中文系列| 狠狠精品干练久久久无码中文字幕 | 中文字幕一区二区三区久久网站| 久久久久无码精品国产app| 久久久久女人精品毛片| 日本WV一本一道久久香蕉| 日本精品久久久久中文字幕8 | 久久国产乱子精品免费女| 久久人人爽人人爽人人av东京热 | 亚洲性久久久影院| 香港aa三级久久三级| 久久国产亚洲高清观看| 精品多毛少妇人妻AV免费久久| 精品国产热久久久福利| 精品一区二区久久久久久久网站| 亚洲AV无码一区东京热久久 | 久久久久免费视频| 久久99精品久久久久久水蜜桃 | 国产精品岛国久久久久| 亚洲精品乱码久久久久久| 久久亚洲sm情趣捆绑调教| 久久久久黑人强伦姧人妻| 国产福利电影一区二区三区久久老子无码午夜伦不 | A级毛片无码久久精品免费 | 久久无码一区二区三区少妇| 亚洲国产精品久久久久久| 亚洲一本综合久久| 草草久久久无码国产专区| 久久精品国产72国产精福利|