锘??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":
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); for( int i =0; i < len; i++ ) { if( str[i] =='' ) continue; else ans += ( str[i] -64 ) * ( i +1 ); } std::cout << ans << std::endl; } return0; }
]]>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> constint maxn =1000+5; usingnamespace 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; for( int i =0; i < n; i++ ) cin >> a[i]; for( int i =0; i < n; i++ ) cin >> b[i]; sort( a, a + n ); sort( b, b + n, cmp ); for( int i =0; i < n; i++ ) if( a[i] + b[i] > t ) ans += a[i] + b[i] - t; cout << ans << endl; } return0; }
]]>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> usingnamespace 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; for( int i =0; i < n; i++ ) { cin >> tmp; ans = lcm( ans, tmp ); } cout << ans - k << endl; } return0; }
]]>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闃朵箻鐨勮綆楅噺鍗佸垎澶э紝鎵浠ユ柉鐗圭伒鍏紡鍗佸垎濂界敤錛岃屼笖錛屽嵆浣垮湪
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> constdouble PI =3.1415926; int main() { int n; int tmp; while( ~scanf("%d", &n ) ) { for( int 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)); } } return0; }
]]>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 />
]]>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>
constint maxn =10;
usingnamespace 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;
for( int 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];