锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲欧洲精品成人久久曰影片,精品久久久久久国产,99久久伊人精品综合观看http://www.shnenglu.com/gzwzm06/category/8774.htmlzh-cnSat, 15 Nov 2008 05:59:14 GMTSat, 15 Nov 2008 05:59:14 GMT60Poj 1840--(鏋氫婦 + hash)http://www.shnenglu.com/gzwzm06/articles/66891.html宸?/dc:creator>宸?/author>Fri, 14 Nov 2008 03:07:00 GMThttp://www.shnenglu.com/gzwzm06/articles/66891.htmlhttp://www.shnenglu.com/gzwzm06/comments/66891.htmlhttp://www.shnenglu.com/gzwzm06/articles/66891.html#Feedback0http://www.shnenglu.com/gzwzm06/comments/commentRss/66891.htmlhttp://www.shnenglu.com/gzwzm06/services/trackbacks/66891.html  1 #include <cstdio>
  2 
  3 const int SIZE = 101 ;
  4 const int MAXN = 14999 ;
  5 
  6 struct HashItem
  7 {
  8     int m_num ;
  9     int m_cnt ;
 10     HashItem *next ;
 11 };
 12 
 13 HashItem hash[MAXN] , g_Temp[10001] ;
 14 int g_Pos ;
 15 int ans ;
 16 
 17 //鐢熸垚x鐨勬墍鏈夊彲鑳藉?br> 18 int gArray[SIZE] ;
 19 int P3(const int& x)
 20 {
 21     return ( x * x * x ) ;
 22 }
 23 void Produce()
 24 {
 25     for ( int i = 0 , j = 0 ; i < SIZE ; ++i )
 26     {
 27         if ( i - 50 != 0 )
 28         {
 29             gArray[j++] = P3(i - 50) ;
 30         }
 31     }
 32 }
 33 
 34 void Insert( const int& num )
 35 {
 36     int tmp ;
 37     if ( num < 0 )
 38         tmp = num * -1 ;
 39     else
 40         tmp = num ;
 41     int key = tmp % MAXN ;
 42     HashItem *ptr = &hash[key] ;
 43     
 44     while ( ptr && ptr->m_cnt != 0 )
 45     {
 46         if ( ptr->m_num == num )
 47         {
 48             ptr->m_cnt++ ;
 49             return ;
 50         } 
 51         ptr = ptr->next ;
 52     }
 53     
 54     if ( hash[key].m_cnt == 0 )
 55     {
 56         hash[key].m_num = num ;
 57         hash[key].m_cnt = 1 ;
 58     }
 59     else {
 60         ptr = &g_Temp[g_Pos++] ;
 61         ptr->m_cnt = 1 ;
 62         ptr->m_num = num ;
 63         ptr->next = hash[key].next ;
 64         hash[key].next = ptr ;
 65     }
 66     
 67 }
 68 
 69 int Find( const int& num )
 70 {
 71     int tmp ;
 72     if ( num < 0 )
 73         tmp = num * -1 ;
 74     else
 75         tmp = num ;
 76     int key = tmp % MAXN ;
 77     HashItem *ptr = &hash[key] ;
 78     
 79     if ( ptr->m_cnt == 0 )
 80     {
 81         return 0 ;
 82     }
 83     
 84     while ( ptr )
 85     {
 86         if ( ptr->m_num == num )
 87         {
 88             return ptr->m_cnt ;
 89         }
 90         
 91         ptr = ptr->next ;
 92     }
 93     
 94     return 0 ;
 95 }
 96 //璁$畻宸﹁竟涓変釜鐨勫鹼紝騫跺垽鏂槸鍚︽弧瓚蟲潯浠?br> 97 void CalLeft(const int& a, const int& b, const int& c)
 98 {
 99     int i , j , k ;
100     int num ;
101     for ( i = 0 ; i < SIZE - 1 ; ++i )
102     {
103         for ( j = 0 ; j < SIZE - 1 ; ++j )
104         {
105             for ( k = 0 ; k < SIZE - 1 ; ++k )
106             {
107                 num = gArray[i] * a + gArray[j] * b + gArray[k] * c ;
108                 num = num * -1 ;
109                 ans += Find(num) ;
110             }
111         }
112     }
113 }
114 //璁$畻鍙寵竟鐨勫煎茍瀛樺叆hash
115 void CalRight(const int& a, const int& b)
116 {
117     int i , j ;
118     int num ;
119     
120     for ( i = 0 ; i < SIZE - 1 ; ++i )
121     {
122         for ( j = 0 ; j < SIZE - 1 ; ++j )
123         {
124             num = gArray[i] * a + gArray[j] * b ;
125             Insert(num) ;
126         }
127     }
128     
129 }
130 
131 void Init()
132 {
133     for ( int i = 0 ; i < MAXN ; ++i )
134     {
135         hash[i].next = NULL ;
136         hash[i].m_cnt = 0 ;
137     }
138     
139     g_Pos = 0 ;
140     ans = 0 ;
141 }
142 
143 int main()
144 {
145    // freopen("in", "r", stdin) ;
146     int a, b, c, d, e ;
147     
148     Produce() ;
149     
150     while ( scanf("%d%d%d%d%d", &a, &b, &c, &d, &e) != EOF )
151     {
152         Init() ;
153         //杞寲涓?nbsp;-(a + b + c) = d + e
154         CalRight( d, e ) ; 
155         CalLeft( a, b, c ) ; 
156                         
157         printf("%d\n", ans) ;
158     }
159     
160     return 0 ;
161 }
162 




]]>
Pku 2002--Squareshttp://www.shnenglu.com/gzwzm06/articles/66746.html宸?/dc:creator>宸?/author>Wed, 12 Nov 2008 12:13:00 GMThttp://www.shnenglu.com/gzwzm06/articles/66746.htmlhttp://www.shnenglu.com/gzwzm06/comments/66746.htmlhttp://www.shnenglu.com/gzwzm06/articles/66746.html#Feedback0http://www.shnenglu.com/gzwzm06/comments/commentRss/66746.htmlhttp://www.shnenglu.com/gzwzm06/services/trackbacks/66746.html濡傛灉鐢ㄨ繃Hash,閭d箞鍙兘涓昏鏄畻鍧愭爣鐨勯棶棰?/span>
  1 #include <cstdio>
  2 #include <cmath>
  3 #include <algorithm>
  4 using namespace std ;
  5 
  6 const int MAXN = 1101 ;
  7 const int KEY = 20011 ;
  8 const int MUL = 33 ;
  9 
 10 struct NODE
 11 {
 12     int x , y ;
 13     NODE *next ;
 14 
 15     NODE(){ next = NULL; }
 16 }hash[KEY] , gTemp[MAXN];
 17 
 18 int gPos ;
 19 
 20 struct POINT
 21 {
 22     int x, y ;
 23          
 24 }g_star[MAXN] ;
 25 
 26 int N ;
 27 
 28 bool cmp( const POINT& a, const POINT& b )
 29 {
 30     if ( a.x < b.x ){
 31         return true ;
 32     }
 33     else if ( a.x == b.x )
 34     {
 35         if ( a.y > b.y )
 36         {
 37             return true ;
 38         }
 39         else
 40             return false ;
 41     }
 42     return false ;
 43 }
 44 //璁$畻鍝堝笇鍊?br> 45 int Cal( const int& sx, const int& sy )
 46 {
 47     int val , x = abs(sx), y = abs(sy) ;
 48     
 49     val = (x * MUL + y) % KEY ;
 50 
 51     return val ;
 52 }
 53 
 54 bool Find( const int& x, const int& y )
 55 {
 56     int pos = Cal( x, y ) ;
 57 
 58     NODE *ptr = hash[pos].next ;
 59 
 60     while ( ptr )
 61     {
 62         if ( ptr->x == x && ptr->y == y )
 63         {
 64             return true ;
 65         }
 66         ptr = ptr->next ;
 67     }
 68 
 69     return false ;
 70 }
 71 
 72 void Insert( const int& x, const int& y )
 73 {
 74     int pos = Cal( x, y ) ;
 75 
 76     NODE *ptr = &gTemp[gPos++] ;
 77 
 78     ptr->x = x ;
 79     ptr->y = y ;
 80     ptr->next = hash[pos].next ;
 81     hash[pos].next = ptr ;
 82 }
 83 //鍒ゆ柇鏄惁鑳界粍鎴愪竴涓鏂瑰艦鑰屼笖涓嶉噸澶?br> 84 bool Judge( const POINT& a, const POINT& b )
 85 {
 86     int dx = ( b.x - a.x ) , dy = ( b.y - a.y ) ;
 87     int x1, y1, x2, y2 ;
 88     int flag = dx * dy ;
 89         
 90         dx = abs(dx) ;
 91         dy = abs(dy) ;
 92 
 93     if ( flag > 0 )
 94     {        
 95         x1 = a.x - dy , y1 = a.y + dx ;
 96         x2 = b.x - dy , y2 = b.y + dx ;
 97     }
 98     else {
 99         x1 = a.x + dy , y1 = a.y + dx ;
100         x2 = b.x + dy , y2 = b.y + dx ;
101     }
102 
103         if ( x1 <= a.x )
104             return false ;
105 
106     if ( Find( x1, y1 ) && Find( x2, y2 ) )
107         return true ;
108     
109     return false ;
110 }
111 
112 void Init()
113 {
114     gPos = 0 ;
115     for ( int i = 0 ; i < KEY ; ++i )
116     {
117         hash[i].next = NULL ;
118     }
119 }
120 
121 int main()
122 {
123     //freopen("in", "r", stdin) ;
124 
125     int i , j , count ;
126 
127     while ( scanf("%d", &N) && N != 0 )
128     {
129         Init() ;
130         count = 0 ;
131 
132         for ( i = 0 ; i < N ; ++i )
133         {
134             scanf("%d %d", &g_star[i].x, &g_star[i].y) ;
135             Insert( g_star[i].x, g_star[i].y ) ;
136         }
137                 //鎸夊乏鍒板彸錛屼笂鍒頒笅
138                 sort(g_star, g_star + N, cmp) ;
139                 
140         for ( i = 0 ; i < N - 1 ; ++i )
141         {
142             for ( j = i + 1 ; j < N ; ++j )
143             {            
144                             if ( Judge(g_star[i], g_star[j]) )
145                 count++ ;
146                 
147             }
148         }
149 
150         printf("%d\n", count) ;
151     }
152 
153     return 0 ;
154 }
155 




]]>
Pku 3349--Snowflake Snow Snowflakeshttp://www.shnenglu.com/gzwzm06/articles/66571.html宸?/dc:creator>宸?/author>Mon, 10 Nov 2008 16:39:00 GMThttp://www.shnenglu.com/gzwzm06/articles/66571.htmlhttp://www.shnenglu.com/gzwzm06/comments/66571.htmlhttp://www.shnenglu.com/gzwzm06/articles/66571.html#Feedback0http://www.shnenglu.com/gzwzm06/comments/commentRss/66571.htmlhttp://www.shnenglu.com/gzwzm06/services/trackbacks/66571.html闃呰鍏ㄦ枃

]]>
Pku 2503--Babelfishhttp://www.shnenglu.com/gzwzm06/articles/66460.html宸?/dc:creator>宸?/author>Sun, 09 Nov 2008 15:15:00 GMThttp://www.shnenglu.com/gzwzm06/articles/66460.htmlhttp://www.shnenglu.com/gzwzm06/comments/66460.htmlhttp://www.shnenglu.com/gzwzm06/articles/66460.html#Feedback0http://www.shnenglu.com/gzwzm06/comments/commentRss/66460.htmlhttp://www.shnenglu.com/gzwzm06/services/trackbacks/66460.html#include <stdio.h>
#include 
<cstring>

const int MAXN = 131101 ;
const int SIZE = 100001 ;
struct HashItem
{
    
char matchStr[12] ;
    
char memStr[12] ;
    HashItem 
*next ;
    HashItem() 
{
        next 
= NULL ;
    }

}
hash[MAXN] , g_Temp[SIZE] ;

int g_Pos ;

int RKHash( char *str )
{
    unsigned 
long hash = 0 ;

    
while ( *str )
    
{
        hash 
= (hash * 26+ (*str - 'a') ;
        str
++ ;
    }


    
return (hash % MAXN) ;
}


void Insert( char *str , char *mstr )
{
    
int key = RKHash( str ) ;

    HashItem 
*= &g_Temp[g_Pos++] ;
    strcpy( p
->memStr, mstr ) ;
    strcpy( p
->matchStr, str ) ;
    p
->next = NULL ;
    p
->next = hash[key].next ;
    hash[key].next 
= p ;
    
}


int Find( char *str , char *mstr )
{
    
int key = RKHash( str ) ;
    
int pos = 0 ;

    HashItem 
*= hash[key].next ;

    
while ( p )
    
{
        
if ( strcmp( p->matchStr, str ) == 0 )
        
{
            pos 
= 1 ;
            strcpy( mstr, p
->memStr ) ;
            
break ;
        }

        p 
= p->next ;
    }

    
    
return pos ;
}


void Init()
{
    g_Pos 
= 0 ;

    
for ( int i = 0 ; i < MAXN ; ++i )
        hash[i].next 
= NULL ;
}


int main()
{
    
char str[2][12] , tmpStr[50] ;
    
int x ;

    Init() ;

    
while ( gets(tmpStr) && tmpStr[0] )
    
{
        sscanf( tmpStr, 
"%s%s", str[0], str[1] ) ;

        Insert( str[
1], str[0] ) ;
    }


    
while ( scanf("%s"&str[0]) != EOF )
    
{
        x 
= Find( str[0] , str[1] ) ;

        
if ( x == 1 )
        
{
            printf(
"%s\n", str[1]) ;
        }

        
else {
            printf(
"eh\n") ;
        }

    }


    
return 0 ;
}


]]>
国产精品99久久久久久www| 欧美精品久久久久久久自慰| 99久久免费国产特黄| 久久久久综合中文字幕| 久久精品国产网红主播| 亚洲v国产v天堂a无码久久| 精品久久久久久无码专区不卡| 久久影视国产亚洲| 久久亚洲日韩看片无码| 午夜精品久久久久久久无码| 2021国内精品久久久久久影院| 久久久久国产精品熟女影院| 精品久久久久国产免费| 国产精品亚洲综合专区片高清久久久| 色婷婷综合久久久久中文字幕| 久久久久人妻一区精品色| 国产免费久久精品99re丫y| 久久线看观看精品香蕉国产| 国产精品天天影视久久综合网| 久久综合日本熟妇| 国产99久久久国产精品~~牛| 亚洲午夜久久久久久噜噜噜| 久久男人Av资源网站无码软件| 久久久精品人妻无码专区不卡| 少妇被又大又粗又爽毛片久久黑人 | 久久夜色精品国产亚洲av| 久久天天躁狠狠躁夜夜avapp| 久久人搡人人玩人妻精品首页| 国产精品禁18久久久夂久| 色妞色综合久久夜夜| 久久婷婷是五月综合色狠狠| 久久久久久久精品妇女99| 大伊人青草狠狠久久| 久久亚洲精精品中文字幕| 亚洲AV无码久久精品色欲| 久久99国产精品99久久| 久久久久99精品成人片| 久久久精品日本一区二区三区| 婷婷综合久久狠狠色99h| 久久99精品久久久久久| 久久er热视频在这里精品|