锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久亚洲AV无码精品色午夜
,精品国产乱码久久久久久郑州公司,久久精品国产秦先生http://www.shnenglu.com/vontroy/category/20306.htmlzh-cnThu, 12 Mar 2015 05:34:57 GMTThu, 12 Mar 2015 05:34:57 GMT60POJ 2653 Pick-up sticks 鍒ゆ柇綰挎鐩鎬氦http://www.shnenglu.com/vontroy/archive/2010/10/03/128488.htmlVontroyVontroySun, 03 Oct 2010 08:21:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/10/03/128488.htmlhttp://www.shnenglu.com/vontroy/comments/128488.htmlhttp://www.shnenglu.com/vontroy/archive/2010/10/03/128488.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/128488.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/128488.htmlPick-up sticks
Time Limit: 3000MS
Memory Limit: 65536K
Total Submissions: 4189
Accepted: 1501
Description
Stan has n sticks of various length. He throws them one at a time on the floor in a random way. After finishing throwing, Stan tries to find the top sticks, that is these sticks such that there is no stick on top of them. Stan has noticed that the last thrown stick is always on top but he wants to know all the sticks that are on top. Stan sticks are very, very thin such that their thickness can be neglected.
Input
Input consists of a number of cases. The data for each case start with 1 <= n <= 100000, the number of sticks for this case. The following n lines contain four numbers each, these numbers are the planar coordinates of the endpoints of one stick. The sticks are listed in the order in which Stan has thrown them. You may assume that there are no more than 1000 top sticks. The input is ended by the case with n=0. This case should not be processed.
Output
For each input case, print one line of output listing the top sticks in the format given in the sample. The top sticks should be listed in order in which they were thrown.
The picture to the right below illustrates the first case from input.
We all know that a pair of distinct points on a plane defines a line and that a pair of lines on a plane will intersect in one of three ways: 1) no intersection because they are parallel, 2) intersect in a line because they are on top of one another (i.e. they are the same line), 3) intersect in a point. In this problem you will use your algebraic knowledge to create a program that determines how and where two lines intersect. Your program will repeatedly read in four points that define two lines in the x-y plane and determine how and where the lines intersect. All numbers required by this problem will be reasonable, say between -1000 and 1000.
Input
The first line contains an integer N between 1 and 10 describing how many pairs of lines are represented. The next N lines will each contain eight integers. These integers represent the coordinates of four points on the plane in the order x1y1x2y2x3y3x4y4. Thus each of these input lines represents two lines on the plane: the line through (x1,y1) and (x2,y2) and the line through (x3,y3) and (x4,y4). The point (x1,y1) is always distinct from (x2,y2). Likewise with (x3,y3) and (x4,y4).
Output
There should be N+2 lines of output. The first line of output should read INTERSECTING LINES OUTPUT. There will then be one line of output for each pair of planar lines represented by a line of input, describing how the lines intersect: none, line, or point. If the intersection is a point then your program should output the x and y coordinates of the point, correct to two decimal places. The final line of output should read "END OF OUTPUT".
]]>POJ 1007 DNA Sorting 瀛楃涓插鐞唡紼沖畾鎺掑簭http://www.shnenglu.com/vontroy/archive/2010/10/02/128354.htmlVontroyVontroySat, 02 Oct 2010 13:23:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/10/02/128354.htmlhttp://www.shnenglu.com/vontroy/comments/128354.htmlhttp://www.shnenglu.com/vontroy/archive/2010/10/02/128354.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/128354.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/128354.html/**//***************** 瀛楃涓插鐞?br />紼沖畾鎺掑簭 ******************/ #include <iostream> #include <algorithm> #include <string> usingnamespace std; struct DNA { int pos; int cnt; string str; }; bool cmp(const DNA &a, const DNA &b) { if (a.cnt != b.cnt) { return a.cnt < b.cnt; } else { return a.pos < b.pos; } } int main() { int n, m, count; DNA ans[110]; string str; cin >> n >> m; for (int i =0; i < m; i++) { cin >> str; count =0; for (int j =0; j < n -1; j++) for (int k = j +1; k < n; k++) if (str[j] > str[k]) count++; ans[i].str = str; ans[i].cnt = count; ans[i].pos = i; } sort(ans, ans + m, cmp); for (int i =0; i < m; i++) cout << ans[i].str << endl; return0; }
]]>POJ 1006 Biorhythms 涓浗鍓╀綑瀹氱悊http://www.shnenglu.com/vontroy/archive/2010/10/02/128347.htmlVontroyVontroySat, 02 Oct 2010 12:18:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/10/02/128347.htmlhttp://www.shnenglu.com/vontroy/comments/128347.htmlhttp://www.shnenglu.com/vontroy/archive/2010/10/02/128347.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/128347.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/128347.html/**//*************************************** 姣旇緝緇忓吀鐨勪腑鍥藉墿浣欏畾鐞唦~ 浣?3×28琚?3闄や綑1錛岀敤33×28×6=5544 浣?3×33琚?8闄や綑1錛岀敤23×33×19=14421 浣?3×28琚?3闄や綑1錛岀敤23×28×2=1288 錛?544×p+14421×e+1288×i錛?錛?3×28×33錛?n+d n=錛?544×p+14421×e+1288×i-d錛?錛?3×28×33錛?br />****************************************/ #include <iostream> #include <cstdio> using std :: cin; using std :: cout; using std :: endl; int get__( int a, int b, int c ) { int ans; int cnt =1; while( ( a * b * cnt ) % c !=1 ) { cnt++; } return a * b * cnt; } int main() { int _p = get__( 28, 33, 23 ); int _e = get__( 23, 33, 28 ); int _i = get__( 23, 28, 33 ); int p, e, i, d; int cas =1; while( cin >> p >> e >> i >> d ) { if( p == e && e == i && i == d && d ==-1 ) break; int ans = ( _p * p + _e * e + _i * i - d ) % ( 23*28*33 ); if( ans <=0 ) printf("Case %d: the next triple peak occurs in %d days.\n", cas++, 21252- ans -2* d); else printf("Case %d: the next triple peak occurs in %d days.\n", cas++, ans); } return0; }
]]>POJ 1005 I Think I Need a Houseboathttp://www.shnenglu.com/vontroy/archive/2010/10/02/128345.htmlVontroyVontroySat, 02 Oct 2010 11:57:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/10/02/128345.htmlhttp://www.shnenglu.com/vontroy/comments/128345.htmlhttp://www.shnenglu.com/vontroy/archive/2010/10/02/128345.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/128345.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/128345.html
/**//****************************************** 璁鵑渶瑕乶騫?br />璁懼崐鍦嗛潰縐負 S錛屽崐寰勪負 r S = 50 * n; S = (PI * r * r) / 2; 瑙e緱 n = (PI * r * r ) / 100; 鎵緇欑偣鍒板師鐐硅窛紱?nbsp;len = sqrt( x * x + y * y ); 浠en = r鍗沖彲瑙e嚭 n *******************************************/ #include <iostream> #include <cstdio> #include <cmath> constdouble PI =3.1415927; usingnamespace std; int main() { double x, y; int cnt; cin >> cnt; int pro =1; while( cnt-- ) { cin >> x >> y; double len = sqrt( x * x + y * y ); int n = (PI * len * len ) / (100*1.0); printf("Property %d: This property will begin eroding in year %d.\n", pro++, n +1); } cout <<"END OF OUTPUT.\n"; return0; }
]]>POJ 3468 A Simple Problem with Integershttp://www.shnenglu.com/vontroy/archive/2010/07/29/121523.htmlVontroyVontroyWed, 28 Jul 2010 23:16:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/07/29/121523.htmlhttp://www.shnenglu.com/vontroy/comments/121523.htmlhttp://www.shnenglu.com/vontroy/archive/2010/07/29/121523.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/121523.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/121523.html#include <iostream> #include <cstdio>
void BuildTree( CNode * pRoot, int L, int R ) { pRoot->L = L; pRoot->R = R; pRoot->nSum =0; pRoot->Inc =0;
if( L == R ) return; nCount++; pRoot->pLeft = Tree + nCount; nCount++; pRoot->pRight = Tree + nCount; BuildTree( pRoot->pLeft, L, ( L + R ) /2 ); BuildTree( pRoot->pRight, ( L + R ) /2+1, R ); }
void Insert( CNode * pRoot, int i, int v ) { if( pRoot->L == i && pRoot->R == i ) { pRoot->nSum = v; return; } pRoot->nSum += v; if( i <= ( pRoot->L + pRoot->R ) /2 ) Insert( pRoot->pLeft, i, v ); else Insert( pRoot->pRight, i, v); }
void Add( CNode * pRoot, int a, int b, longlong c ) { if( a == pRoot->L && b == pRoot->R ) { pRoot->Inc += c; return; } pRoot->nSum += ( b - a +1 ) * c; if( b <= ( pRoot->L + pRoot->R ) /2) Add( pRoot->pLeft, a, b, c ); elseif ( a >= (pRoot->L + pRoot->R ) /2+1 ) Add ( pRoot->pRight, a, b, c ); else { Add( pRoot->pLeft, a, ( pRoot->L + pRoot->R ) /2, c ); Add( pRoot->pRight, (pRoot->L + pRoot->R ) /2+1, b, c ); } }
longlong QuerynSum( CNode * pRoot, int a, int b ) { if ( a == pRoot->L && b == pRoot->R ) return (pRoot->nSum + (pRoot->R - pRoot->L +1 ) * pRoot->Inc); pRoot->nSum += (pRoot->R - pRoot->L +1 ) * pRoot->Inc; Add( pRoot->pLeft, pRoot->L, (pRoot->L + pRoot->R ) /2, pRoot->Inc ); Add( pRoot->pRight, (pRoot->L + pRoot->R ) /2+1, pRoot->R, pRoot->Inc ); pRoot->Inc =0;
if( b <= (pRoot->L + pRoot->R ) /2 ) return QuerynSum( pRoot->pLeft, a, b ); elseif ( a >= (pRoot->L + pRoot->R ) /2+1 ) return QuerynSum ( pRoot->pRight, a, b); else return QuerynSum( pRoot->pLeft, a, (pRoot->L +pRoot->R ) /2 ) + QuerynSum( pRoot->pRight, (pRoot->L + pRoot->R ) /2+1, b ) ; }
int main() { int n,q; scanf("%d%d", &n, &q ); nCount =0; BuildTree( Tree, 1, n); int temp; for( int i =1; i <= n; i++ ) { scanf("%d", &temp); Insert( Tree, i, temp ); } char c_temp[10]; int a, b, c; for( int i =0; i < q; i++ ) { scanf("%s", c_temp); if( c_temp[0] =='C' ) { scanf("%d%d%d", &a, &b, &c ); Add( Tree, a, b, c); } else { scanf("%d%d", &a, &b ); printf("%I64d\n",QuerynSum( Tree, a, b )); } } return0; }
struct CNode { int R, L; int nMax, nMin; CNode * pLeft, * pRight; }Tree[1000000];
//CNode Tree[1000000]; int nMax, nMin; int nCount =0;
void BuildTree( CNode * pRoot, int L, int R ) { pRoot->L = L; pRoot->R = R;
pRoot->nMax = MY_MAX; pRoot->nMin = MY_MIN;
if( R != L ) { nCount++; pRoot->pLeft = Tree + nCount; nCount++; pRoot->pRight = Tree + nCount; BuildTree( pRoot->pLeft, L, ( L + R ) /2 ); BuildTree( pRoot->pRight, ( L + R ) /2+1, R ); } }
void Insert( CNode * pRoot, int i, int v ) { if( pRoot->L == i &&pRoot-> R == i ) { pRoot-> nMin = pRoot-> nMax = v; return ; }
if( i <= ( pRoot->L + pRoot->R ) /2 ) Insert( pRoot->pLeft, i, v ); else Insert( pRoot->pRight, i, v ); }
void Query( CNode * pRoot, int s, int e ) { if( pRoot->nMax <= nMax && pRoot->nMin >= nMin ) return ; if( s == pRoot->L && e == pRoot->R ) { nMax = max(pRoot->nMax, nMax); nMin = min(pRoot->nMin,nMin); return; } if( e <= ( pRoot->L + pRoot->R ) /2 ) Query( pRoot->pLeft, s, e ); elseif ( s >= ( pRoot->L + pRoot->R ) /2+1 ) Query( pRoot->pRight, s, e ); else { Query( pRoot->pLeft, s, ( pRoot->L + pRoot->R ) /2 ); Query( pRoot->pRight, ( pRoot->L + pRoot->R) /2+1, e ) ; } }
int main() { int n, q, s, e; int h; scanf("%d%d", &n, &q); nCount =0; BuildTree( Tree, 1, n); for( int i =1; i <= n; i++ ) { scanf("%d", &h); Insert( Tree, i, h ); } for( int i =0; i < q; i++) { scanf("%d%d", &s,&e ); nMax = MY_MAX; nMin = MY_MIN; Query( Tree, s, e ); printf("%d\n", nMax - nMin) ; } return0; }
]]>POJ 1001 Exponentiation http://www.shnenglu.com/vontroy/archive/2010/05/26/116341.htmlVontroyVontroyTue, 25 May 2010 23:30:00 GMThttp://www.shnenglu.com/vontroy/archive/2010/05/26/116341.htmlhttp://www.shnenglu.com/vontroy/comments/116341.htmlhttp://www.shnenglu.com/vontroy/archive/2010/05/26/116341.html#Feedback0http://www.shnenglu.com/vontroy/comments/commentRss/116341.htmlhttp://www.shnenglu.com/vontroy/services/trackbacks/116341.htmlExponentiation
Time Limit: 500MS
Memory Limit: 10000K
Total Submissions: 68964
Accepted: 16146
Description
Problems involving the computation of exact values of very large magnitude and precision are common. For example, the computation of the national debt is a taxing experience for many computer systems.
This problem requires that you write a program to compute the exact value of Rn where R is a real number ( 0.0 < R < 99.999 ) and n is an integer such that 0 < n <= 25.
Input
The input will consist of a set of pairs of values for R and n. The R value will occupy columns 1 through 6, and the n value will be in columns 8 and 9.
Output
The output will consist of one line for each line of input giving the exact value of R^n. Leading zeros should be suppressed in the output. Insignificant trailing zeros must not be printed. Don't print the decimal point if the result is an integer.
publicclass Main{ publicstaticvoid main( String args[] ) { BigDecimal num; int n; String r; Scanner cin = new Scanner(System.in);
while(cin.hasNextBigDecimal()) { num = cin.nextBigDecimal(); n = cin.nextInt();
num = num.pow(n); r = num.stripTrailingZeros().toPlainString();//BigDecimal.toPlainString 閬垮厤杈撳嚭鏃朵駭鐢熺瀛﹁鏁版硶褰㈠紡 if(r.startsWith("0.")) r = r.substring(1); System.out.println(r); } } }