最大公約數:
{ Author:wzx961008 Problem:UVa 11417-GCD Verdict:Accepted Language:PASCAL Run Time:0.044s Submission Date:2011-02-11 03:54:23 } var i,j,g,n:longint; f:array[1..501,1..501]of longint; function gcd(a,b:longint):longint; begin if a=0 then exit(b) else exit(gcd(b mod a,a)) end; begin while true do begin readln(n); if n=0 then break; g:=0; for i:=1 to n-1 do for j:=i+1 to n do begin if f[i,j]=0 then begin f[i,j]:=gcd(i,j); f[j,i]:=f[i,j]; end; g:=g+f[i,j]; end; writeln(g); end; end.
題目:VJ:UVa400 代碼實現: #include<iostream> #include<vector> #include<string> #include<algorithm> using namespace std; int
題目:UVa12563 代碼實現: #include<iostream> #include<cstdio> #include<utility> #include<algorithm> using namespace std; typ
題目鏈接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1756 Andy, 8, ha
題目鏈接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=342 Palindrome
UVa OJ The Dole Queue 救濟金髮放 133 題目大意: 給定一個整數 N ,然後逆時針排列從 1 到 N ,然後給定兩個整數 k 和 m ,順時針從 1 數到 k,選定這個數(假設爲 w),逆時針(從N)開始,然後數
水題,直接模擬: { Author:wzx961008 Problem:UVa 10302-Summation of Polynomials Verdict:Accepted Language:PASCAL Run Time:0
題目能夠水成這樣: { Author:wzx961008 Problem:UVa 11727-Cost Cutting Verdict:Accepted Language:PASCAL Run Time:0.012s Subm
高精: { Author:wzx961008 Problem:UVa 10106-Product Verdict:Accepted Language:PASCAL Run Time:0.020s Submission Da
純數學題,搞了好久: { Author:wzx961008 Problem:UVa 10994-Simple Addition Verdict:Accepted Language:PASCAL Run Time:0.028s
簡單題: { Author:wzx961008 Problem:UVa 490-Rotating Sentences Verdict:Accepted Language:PASCAL Run Time:0.016s S
巨水: { Author:wzx961008 Problem:UVa 11636-Hello World! Verdict:Accepted Language:PASCAL Run Time:0.012s Submission
非常簡單的模擬: { Author:wzx961008 Problem:UVa 445-Marvelous Mazes Verdict:Accepted Language:PASCAL Run Time:0.004s S
水題,高精: { Author:wzx961008 Problem:UVa 495-Fibonacci Freeze Verdict:Accepted Language:PASCAL Run Time:0.660s Sub
UVa OJ 1607 - Gates Problem 描述起來很麻煩,大家還是直接去OJ站看吧。我之後也會解釋一下題目的意思 題目鏈接: 1607 - Gates Input The first line of the in
UVa OJ 1609 - Foul Play Problem n支隊伍(2≤n≤1024,且n是2的整數冪)打淘汰賽,每輪都是兩兩配對,勝者進入下一輪。每支隊伍的實力固定,並且已知每兩支隊伍之間的一場比賽結果。你喜歡1號隊。雖然