167 条题解
-
-1
zsy78191 LV 7 @ 2012-11-29 12:23:45
VijosNT Mini 2.0.5.7 Special for Vijos
编译通过...
├ 测试数据 01:答案正确... (0ms, 248KB)
├ 测试数据 02:答案正确... (0ms, 248KB)
├ 测试数据 03:答案正确... (15ms, 248KB)
├ 测试数据 04:答案正确... (74ms, 248KB)
├ 测试数据 05:答案错误... (31ms, 248KB)
├ 测试数据 06:答案正确... (0ms, 248KB)
├ 测试数据 07:答案正确... (46ms, 248KB)
├ 测试数据 08:答案正确... (0ms, 248KB)
├ 测试数据 09:答案错误... (15ms, 248KB)
├ 测试数据 10:答案正确... (0ms, 248KB)谁能把第五个数据和第九个数据透露一下。。蛋疼。
-
-1@ 2012-11-06 17:07:39
高精度,具体方法还是数组解决...程序不简单
-
-1@ 2012-09-16 11:27:38
var a,b,c:integer;
begin
read(a,b);
if a>b then c:=a else c:=b;
while (c mod a0) or (c mod b0) do c:=c+1;
write(C)
end. -
-1@ 2010-04-02 15:09:08
#include
using namespace std;
int main(){
long long i,j,c,max,min;
while(cin>>i>>j){
if(i -
-1@ 2010-03-08 20:31:48
87行 1次AC 很爽感
不过调了很久
GCD对于高精还是不用函数用过程好,否则爆栈。。 -
-1@ 2009-11-09 15:48:21
type
nt=array[1..2,1..101]of longint;var
t,s:string;
a,b:nt;
i,j,l1,l2:longint;
flag:boolean;procedure adda(var a:nt);
var
i:longint;
begin
for i:=l1 downto 1 do
begin
a[2,i]:=a[2,i]+a[1,i];
a[2,i+1]:=a[2,i+1]+a[2,i] div 10;
a[2,i]:=a[2,i] mod 10;
end;
if a[2,l1+1]>0 then inc(l1);
end;procedure addb(var b:nt);
var
i:longint;
begin
for i:=l2 downto 1 do
begin
b[2,i]:=b[2,i]+b[1,i];
b[2,i+1]:=b[2,i+1]+b[2,i] div 10;
b[2,i]:=b[2,i] mod 10;
end;
if b[2,l2+1]>0 then inc(l2);
end;procedure print;
begin
for i:=l1 downto 1 do
write(a[2,i]);
writeln;
flag:=false;
end;procedure getmin(var a,b:nt);
begin
if l1l2 then addb(b)
else
begin
for i:=l1 downto 1 do
if a[2,i]=b[2,i] then continue
else
if a[2,i]b[2][i] then
begin
addb(b);
exit;
end;
print;
end;
end;begin
flag:=true;
readln(s);t:=copy(s,1,pos(' ',s)-1);
l1:=length(t);
for i:=1 to l1 do
val(t[i],a[2,l1-i+1]);
a[1]:=a[2];t:=copy(s,pos(' ',s)+1,length(s)-l1-1);
l2:=length(t);
for i:=1 to l2 do
val(t[i],b[2,l2-i+1]);
b[1]:=b[2];while flag do getmin(a,b);
end.
先膜拜下matrix67神牛。OTL。
好,开始。
他blog里面有篇求lcm的文章,觉得那方法很叼。于是就来做这题,
参看 http://www.matrix67.com/blog/archives/554
结果基本上都超时了。。
我的程序,用a[1],b[1]来记录初始值,a[2]参与运算。
就用的matrix67的思想(我说过一次了)。
但是TLE了6个点。(我又说过了)。
各位看下有什么优化的方法。
-
-1@ 2009-08-11 21:18:47
program f;
var a,b:integer;
function apple(a1,b1:integer):integer;
var i:integer;
begin
for i:=1 to a1 do
if (i*b1mod a1=0)then
begin apple:=i*b1;break;end;
end;
begin
readln(a,b);
writeln(apple(a,b));
readln;
end.