锘??xml version="1.0" encoding="utf-8" standalone="yes"?>囯产精品久久久久久久久蜜桃,国内精品伊人久久久久网站,久久久久久久免费视频http://www.shnenglu.com/vontroy/category/20307.htmlzh-cnSun, 13 Jan 2013 07:47:31 GMTSun, 13 Jan 2013 07:47:31 GMT60HDU 2734 Quicksum 綆鍗曞瓧絎︿覆澶勭悊http://www.shnenglu.com/vontroy/archive/2010/10/03/128420.htmlVontroyVontroySun, 03 Oct 2010 02:03:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/10/03/128420.htmlhttp://www.shnenglu.com/vontroy/comments/128420.htmlhttp://www.shnenglu.com/vontroy/archive/2010/10/03/128420.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/128420.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/128420.html

Quicksum

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 492    Accepted Submission(s): 408

Problem Description
A checksum is an algorithm that scans a packet of data and returns a single number. The idea is that if the packet is changed, the checksum will also change, so checksums are often used for detecting transmission errors, validating document contents, and in many other situations where it is necessary to detect undesirable changes in data.

For this problem, you will implement a checksum algorithm called Quicksum. A Quicksum packet allows only uppercase letters and spaces. It always begins and ends with an uppercase letter. Otherwise, spaces and letters can occur in any combination, including consecutive spaces.

A Quicksum is the sum of the products of each character's position in the packet times the character's value. A space has a value of zero, while letters have a value equal to their position in the alphabet. So, A=1, B=2, etc., through Z=26. Here are example Quicksum calculations for the packets "ACM" and "MID CENTRAL":

ACM: 1*1 + 2*3 + 3*13 = 46MID CENTRAL: 1*13 + 2*9 + 3*4 + 4*0 + 5*3 + 6*5 + 7*14 + 8*20 + 9*18 + 10*1 + 11*12 = 650
 

Input
The input consists of one or more packets followed by a line containing only # that signals the end of the input. Each packet is on a line by itself, does not begin or end with a space, and contains from 1 to 255 characters.
 

Output
For each packet, output its Quicksum on a separate line in the output.
 

Sample Input
ACM MID CENTRAL REGIONAL PROGRAMMING CONTEST ACN A C M ABC BBC #
 

Sample Output
46 650 4690 49 75 14 15


#include <iostream>
#include 
<cstdio>
#include 
<cstring>

int main()
{
    
char str[260];
    
int ans = 0;
    
while( gets(str) && str[0!= '#' )
    
{
        ans 
= 0;
        
int len = strlen(str);
        
forint i = 0; i < len; i++ )
        
{
            
if( str[i] == ' ' )
                
continue;
            
else
                ans 
+= ( str[i] - 64 ) * ( i + 1 );
        }

        std::cout 
<< ans << std::endl;
    }

    
return 0;
}




Vontroy 2010-10-03 10:03 鍙戣〃璇勮
]]>
HDU 3661 Assignments-2010 Harbin Regionalhttp://www.shnenglu.com/vontroy/archive/2010/10/03/128409.htmlVontroyVontroySun, 03 Oct 2010 00:36:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/10/03/128409.htmlhttp://www.shnenglu.com/vontroy/comments/128409.htmlhttp://www.shnenglu.com/vontroy/archive/2010/10/03/128409.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/128409.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/128409.htmlAssignments

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 252    Accepted Submission(s): 125


Problem Description
In a factory, there are N workers to finish two types of tasks (A and B). Each type has N tasks. Each task of type A needs xi time to finish, and each task of type B needs yj time to finish, now, you, as the boss of the factory, need to make an assignment, which makes sure that every worker could get two tasks, one in type A and one in type B, and, what's more, every worker should have task to work with and every task has to be assigned. However, you need to pay extra money to workers who work over the standard working hours, according to the company's rule. The calculation method is described as follow: if someone’ working hour t is more than the standard working hour T, you should pay t-T to him. As a thrifty boss, you want know the minimum total of overtime pay.
 

Input
There are multiple test cases, in each test case there are 3 lines. First line there are two positive Integers, N (N<=1000) and T (T<=1000), indicating N workers, N task-A and N task-B, standard working hour T. Each of the next two lines has N positive Integers; the first line indicates the needed time for task A1, A2…An (Ai<=1000), and the second line is for B1, B2…Bn (Bi<=1000).
 

Output
For each test case output the minimum Overtime wages by an integer in one line.
 

Sample Input
2 5 4 2 3 5
 

Sample Output
4
 
//綆鍗曡椽蹇?/span>
#include <iostream>
#include 
<cstdio>
#include 
<algorithm>

const int maxn = 1000 + 5;

using namespace std;

bool cmp( int a, int b )
{
    
return a > b;
}


int main()
{
    
int a[maxn], b[maxn];
    
int n, t, ans = 0;
    
while( cin >> n >> t )
    
{
        ans 
= 0;
        
forint i = 0; i < n; i++ )
            cin 
>> a[i];
        
forint i = 0; i < n; i++ )
            cin 
>> b[i];

        sort( a, a 
+ n );
        sort( b, b 
+ n, cmp );

        
forint i = 0; i < n; i++ )
            
if( a[i] + b[i] > t )
                ans 
+= a[i] + b[i] - t;
        cout 
<< ans << endl;
    }

    
return 0;
}



Vontroy 2010-10-03 08:36 鍙戣〃璇勮
]]>
HDU 1097 A hard puzzlehttp://www.shnenglu.com/vontroy/archive/2010/10/03/128381.htmlVontroyVontroySat, 02 Oct 2010 16:39:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/10/03/128381.htmlhttp://www.shnenglu.com/vontroy/comments/128381.htmlhttp://www.shnenglu.com/vontroy/archive/2010/10/03/128381.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/128381.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/128381.html//鎵捐寰嬶紝姣?涓暟寰幆涓嬈?/span>
#include <iostream>
#include 
<cstdio>

using namespace std;

int main()
{
    
long long a, b;
    
int ans[5];
    
while(cin >> a >> b)
    
{
        
if( b == 0 )
        
{
            cout 
<< "1" << endl;
            
continue;
        }

        
else if( a == 0 )
        
{
            cout 
<< "0" << endl;
            
continue;
        }

        ans[
1= a % 10;
        ans[
2= (ans[1* a ) % 10;
        ans[
3= (ans[2* a ) % 10;
        ans[
4= (ans[3* a ) % 10;

        
int tmp = b % 4;
        
if( tmp == 0 ) tmp = 4;
        cout 
<< ans[tmp] << endl;
    }

    
return 0;
}



Vontroy 2010-10-03 00:39 鍙戣〃璇勮
]]>
HDU 1452 Happy 2004(鍥犲瓙鍜?http://www.shnenglu.com/vontroy/archive/2010/10/02/128356.htmlVontroyVontroySat, 02 Oct 2010 14:08:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/10/02/128356.htmlhttp://www.shnenglu.com/vontroy/comments/128356.htmlhttp://www.shnenglu.com/vontroy/archive/2010/10/02/128356.html#Feedback1http://www.shnenglu.com/vontroy/comments/commentRss/128356.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/128356.html/*************************************************************
 璁$畻 2004^X鐨勫洜瀛愬拰 s(2004^X)   mod M, M=29

  s(2004^X)%29
  鍥犲瓙鍜?nbsp;s鏄Н鎬у嚱鏁?鍗?nbsp;錛歡cd(a,b)=1==> s(a*b)= s(a)*s(b)

  2004^X=4^X * 3^X *167^X
  s(2004^X)=  s(2^(2X))* s(3^X) * s(167^X)

  濡傛灉 p鏄礌鏁?nbsp;==> s(p^X)=1+p+p^2++p^X = (p^(X+1)-1) /(p-1)

  s(2004^X)=錛?^(2X+1)-1錛? (3^(X+1)-1)/2  *(167^(X+1)-1)/166

  167%29=22

  s(2004^X)=錛?^(2X+1)-1錛? (3^(X+1)-1)/2  *(22^(X+1)-1)/21

  (a*b)/c %M= a%M* b%M  * inv(c)

  c*inv(c)=1 %M    妯′負1鐨勬墍鏈夋暟  inv錛坈錛変負鏈灝忓彲浠ヨc鏁撮櫎鐨?br />
    inv(2)=15,  inv(21)=18    2*15=1 mod 29, 18*21=1 mod 29

  s(2004^X)=錛?^(2X+1)-1錛? (3^(X+1)-1)/2  *(22^(X+1)-1)/21
           =錛?^(2X+1)-1錛? (3^(X+1)-1)*15 *(22^(X+1)-1)*18
**************************************************************
*/


//hdu 1452
#include <iostream>
#include 
<cstdio>
#include 
<cmath>

using namespace std;

int _pow( int a, int n )
{
    
int b = 1;
    
while( n > 1 )
        
if( n % 2 == 0 )
        
{
            a 
= ( a * a ) % 29;
            n 
/= 2;
        }

        
else
        
{
            b 
= b * a % 29;
            n
--;
        }

        
return a * b % 29;
}

int main()
{
    
int X;
    
int a, b, c;
    
while( cin >> X, X )
    
{
        a 
= _pow( 22 * X + 1 );
        b 
= _pow( 3, ( X + 1 ) );
        c 
= _pow( 22, ( X + 1 ) );

        cout 
<< ( a - 1 ) * ( b - 1 ) * 15 * ( c - 1 ) * 18 % 29 << endl;
    }

    
return 0;
}



Vontroy 2010-10-02 22:08 鍙戣〃璇勮
]]>
HDU 1056 HangOverhttp://www.shnenglu.com/vontroy/archive/2010/10/02/128314.htmlVontroyVontroySat, 02 Oct 2010 08:08:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/10/02/128314.htmlhttp://www.shnenglu.com/vontroy/comments/128314.htmlhttp://www.shnenglu.com/vontroy/archive/2010/10/02/128314.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/128314.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/128314.html#include <iostream>
#include 
<cstdio>

using namespace std;

int main()
{
    
double len;
    
double tmp;
    
int ans;

    
while( cin >> len, len )
    
{
        tmp 
= 0;
        ans 
= 1;
        
while( ans++ )
        
{
            tmp 
+= 1 / ( ans * 1.0 );
            
if( tmp >= len )
            
{
                cout 
<< ans - 1 << " card(s)" << endl;
                
break;
            }

        }

    }

    
return 0;
}



Vontroy 2010-10-02 16:08 鍙戣〃璇勮
]]>
HDU 1788 Chinese remainder theorem againhttp://www.shnenglu.com/vontroy/archive/2010/10/02/128310.htmlVontroyVontroySat, 02 Oct 2010 06:58:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/10/02/128310.htmlhttp://www.shnenglu.com/vontroy/comments/128310.htmlhttp://www.shnenglu.com/vontroy/archive/2010/10/02/128310.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/128310.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/128310.html/**********************************
N % MI = MI - a
鍥犱負 a < MI
鍘熷紡絳変環浜?nbsp;(N + a) % MI = 0
鎵浠ユ棰樹負姹?nbsp;M0 鍒?nbsp;MI 鐨勬渶灝忓叕鍊嶆暟

(娉ㄦ剰綺懼害闂,鐢╛_int64)

**********************************
*/


#include 
<iostream>
#include 
<cstdio>

using namespace std;

__int64 gcd( __int64 a, __int64 b )
{
    
if( b == 0 ) return a;
    
return gcd( b, a % b );
}


__int64 lcm( __int64 a, __int64 b )
{
    
return a * b / gcd( a, b );
}


int main()
{
    
int n, k;
    
int tmp;
    __int64 ans;
    
while( cin >> n >> k, n || k )
    
{
        ans 
= 1;
        
forint i = 0; i < n; i++ )
        
{
            cin 
>> tmp;
            ans 
= lcm( ans, tmp );
        }

        cout 
<< ans - k << endl;
    }

    
return 0;
}



Vontroy 2010-10-02 14:58 鍙戣〃璇勮
]]>
HDU 1018 Big Numberhttp://www.shnenglu.com/vontroy/archive/2010/10/02/128302.htmlVontroyVontroySat, 02 Oct 2010 06:22:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/10/02/128302.htmlhttp://www.shnenglu.com/vontroy/comments/128302.htmlhttp://www.shnenglu.com/vontroy/archive/2010/10/02/128302.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/128302.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/128302.html鏂壒鐏靛叕寮?/strong>鏄竴鏉$敤鏉ュ彇n闃朵箻榪戜技鍊?/font>鐨?font color="#000000">鏁板鍏紡銆備竴鑸潵璇達紝褰搉寰堝ぇ鐨勬椂鍊欙紝n闃朵箻鐨勮綆楅噺鍗佸垎澶э紝鎵浠ユ柉鐗圭伒鍏紡鍗佸垎濂界敤錛岃屼笖錛屽嵆浣垮湪

 

n寰堝皬鐨勬椂鍊欙紝鏂壒鐏靛叕寮忕殑鍙栧煎凡緇忓崄鍒嗗噯紜?/p>

鍏紡涓猴細

榪欏氨鏄錛屽浜庤凍澶熷ぇ鐨勬暣鏁?em>n錛岃繖涓や釜鏁頒簰涓鴻繎浼煎箋傛洿鍔犵簿紜湴錛?img border="0" alt="" src="http://www.shnenglu.com/images/cppblog_com/vontroy/2.png" width="194" height="65" />

鎴栬咃細

 

 

Big Number

Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 8759    Accepted Submission(s): 3879


Problem Description
In many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this problem you are given a number, you have to determine the number of digits in the factorial of the number.
 
Input
Input consists of several lines of integer numbers. The first line contains an integer n, which is the number of cases to be tested, followed by n lines, one integer 1 ≤ n ≤ 107 on each line.
 
Output
The output contains the number of digits in the factorial of the integers appearing in the input.
 
Sample Input
2 10 20
Sample Output
7 19
//log10(n!)=(0.5*log(2*PI*n)+n*log(n)-n)/log(10)

#include 
<iostream>
#include 
<cstdio>
#include 
<cmath>

const double PI = 3.1415926;

int main()
{
    
int n;
    
int tmp;
    
while~scanf("%d"&n ) )
    
{
        
forint i = 0; i < n; i++ )
        
{
            scanf(
"%d"&tmp);
            
double cnt = 1;
            cnt 
+= (0.5 * log( 2 * PI * tmp ) + tmp * log( tmp ) - tmp ) / log(10);
            printf(
"%d\n", (int)(cnt));
        }

    }

    
return 0;
}



Vontroy 2010-10-02 14:22 鍙戣〃璇勮
]]>
HDU 1316 How Many Fibs?http://www.shnenglu.com/vontroy/archive/2010/10/02/128300.htmlVontroyVontroySat, 02 Oct 2010 06:00:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/10/02/128300.htmlhttp://www.shnenglu.com/vontroy/comments/128300.htmlhttp://www.shnenglu.com/vontroy/archive/2010/10/02/128300.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/128300.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/128300.html浠g爜錛?br />
import java.util.*;
import java.math.*;

public class Main{
    
public static void main( String args[] )
    
{
        Scanner in 
= new Scanner( System.in );
        
int cnt = 0;
        BigInteger fib1, fib2;
        BigInteger fla1, fla2;
        
while( in.hasNext() )
        
{
            fib1 
= BigInteger.valueOf(1);
            fib2 
= BigInteger.valueOf(2);
            
            fla1 
= in.nextBigInteger();
            fla2 
= in.nextBigInteger();
            
if( fla1.equals(BigInteger.valueOf(0)) && fla2.equals(BigInteger.valueOf(0))) break;
            
            cnt 
= 0;
            
            
whiletrue )
            
{
                
if( fib1.compareTo(fla1) >= 0 && fib1.compareTo(fla2) <= 0 ) cnt++;
                
if( fib2.compareTo(fla1) >= 0 && fib2.compareTo(fla2) <= 0 ) cnt++;
                
if( fib1.compareTo(fla2) > 0 || fib2.compareTo(fla2) > 0 ) break;
                fib1 
= fib1.add(fib2);
                fib2 
= fib2.add(fib1);
            }

            System.out.println( cnt );
        }

    }

}


Vontroy 2010-10-02 14:00 鍙戣〃璇勮
]]>
HDU 1198 Farm Irrigationhttp://www.shnenglu.com/vontroy/archive/2010/07/29/121520.htmlVontroyVontroyWed, 28 Jul 2010 23:04:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/07/29/121520.htmlhttp://www.shnenglu.com/vontroy/comments/121520.htmlhttp://www.shnenglu.com/vontroy/archive/2010/07/29/121520.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/121520.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/121520.html#include<iostream>
using namespace std;

int bin[2500];

int find(int x)
{
return x==bin[x]?x:find(bin[x]);}

void merge(int x,int y)
{
    x
=find(x);
    y
=find(y);
    
if(x!=y) bin[x]=y;
}

int main()
{
    
int a[11= {93126510111314715}, m, n, i, j, map[50][50], total;
    
char c;
    
while(scanf("%d %d"&m, &n), m != -1 || n != -1){
        getchar();
        
for(i = 0; i < m; ++i){
            
for(j = 0; j < n; ++j){
                scanf(
"%c"&c);
                map[i][j] 
= c - 65;
            }
            getchar();
        }
        
for(i = 0; i < m * n; ++i) bin[i] = i;
        
for(i = 0; i < m; ++i)
            
for(j = 0; j < n; ++j){
                
if(i + 1 < m && a[map[i][j]] & 0x04 && a[map[i + 1][j]] & 0x01)
                    merge(i 
* n + j, i * n + n + j);
                
if(j + 1 < n && a[map[i][j]] & 0x02 && a[map[i][j + 1]] & 0x08)
                    merge(i 
* n + j, i * n + j + 1);
            }
        
for(total = 0, i = 0; i < m * n; ++i)
            
if(i == bin[i]) ++total;
        printf(
"%d\n", total);
    }
    
return 0;
}


Vontroy 2010-07-29 07:04 鍙戣〃璇勮
]]>
HDU 1010 Tempter of the Bonehttp://www.shnenglu.com/vontroy/archive/2010/07/29/121519.htmlVontroyVontroyWed, 28 Jul 2010 22:58:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/07/29/121519.htmlhttp://www.shnenglu.com/vontroy/comments/121519.htmlhttp://www.shnenglu.com/vontroy/archive/2010/07/29/121519.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/121519.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/121519.html#include <iostream>
#include 
<cstdio>
#include 
<cmath>

const int maxn = 10;

using namespace std;

bool escape;

char map[maxn][maxn];

int dir[4][2= {{-1,0}, {1,0}, {0,-1}, {0,1}};
int n, m, t;
int si, sj, di, dj;

void dfs( int x, int y, int cnt )
{
    
if( escape ) return;

    
if( x == di && y == dj && cnt == t )
    {
        escape 
= 1;
        
return;
    }

    
int temp = t - cnt - ( fabs(di - x) + fabs(dj - y ) );

    
if( temp < 0 || temp % 2 != 0 )     return;//濂囧伓鍓灊

    
if( x <= 0 || y <= 0 || x > n || y > m )    return;

    
forint i = 0; i < 4; i++ )
    {
        
if( map[x+dir[i][0]][y+dir[i][1]] != 'X')
        {
            map[x
+dir[i][0]][y+dir[i][1]] = 'X';
            dfs(x
+dir[i][0], y+dir[i][1], cnt+1);
            map[x
+dir[i][0]][y+dir[i][1]] = '.';
        }
    }

}

int main()
{
    
while( cin >> n >> m >> t, m || n || t )
    {
        
int wall = 0;
        escape 
= 0;
        
for ( int i = 1; i <= n; i++ )
            
for ( int j = 1; j <= m; j++ )
            {
                cin 
>> map[i][j];

                
if( map[i][j] == 'D')
                {
                    di 
= i;
                    dj 
= j;
                }

                
else if ( map[i][j] == 'S' )
                {
                    si 
= i;
                    sj 
= j;
                }

                
else if ( map[i][j] == 'X' )
                    wall 
++ ;
            }

        
if( m * n - wall <= t )
        {
            printf(
"NO\n");
            
continue;
        }
        
else
        {
            map[si][sj] 
= 'X';
            dfs( si, sj, 
0 );
            printf(
"%s\n", escape ? "YES" : "NO" );
        }
    }
    
return 0;
}


Vontroy 2010-07-29 06:58 鍙戣〃璇勮
]]>
国内精品久久久久影院薰衣草| 久久精品国产亚洲77777| 免费精品99久久国产综合精品| 久久久噜噜噜www成人网| 狠狠色噜噜狠狠狠狠狠色综合久久| 国产精品久久久久无码av| 久久精品一区二区三区中文字幕| 久久久久国色AV免费观看| 国产精品乱码久久久久久软件| 久久夜色精品国产欧美乱| 久久久91精品国产一区二区三区 | 久久福利青草精品资源站| 国产精品日韩欧美久久综合| 97精品伊人久久大香线蕉| 99久久99久久精品免费看蜜桃| 精品综合久久久久久88小说| 午夜天堂av天堂久久久| 精品久久久久久久中文字幕| 亚洲国产另类久久久精品小说| 国产精品久久久久久久午夜片| 国产毛片欧美毛片久久久| 国产精品热久久无码av| 久久99精品久久久久久久不卡| 欧美精品丝袜久久久中文字幕| AV狠狠色丁香婷婷综合久久| 波多野结衣久久| 久久久久婷婷| 91精品国产91久久久久久蜜臀| 久久久精品国产免大香伊| 精品欧美一区二区三区久久久| 国产精品久久一区二区三区| 7777精品伊人久久久大香线蕉 | 色偷偷888欧美精品久久久| 亚洲精品成人久久久| 久久99精品国产麻豆婷婷| 91久久福利国产成人精品| 久久精品国产亚洲AV香蕉| 日本强好片久久久久久AAA | 久久亚洲欧美日本精品| 精品一区二区久久| 久久午夜电影网|