1.正常写法
var
a,b:longint;
begin
readln(a,b);
writeln(a+b);
end.
2.随机数
就是强行把结果算出来以后看人品。。。
var
a,b,c:longint;
begin
randomize;
readln(a,b);
while true do
begin
c:=random(100000000);
if c=a+b
then
begin
writeln(c);
halt;
end;
end;
end.
3.深搜
吧a和b当成两个节点一共有三个,从第一个开始往下搜,搜到不能搜为止
var
f,l:array[1..10] of longint;
i,j,k,n,m,a,b,ans:longint;
procedure dfs(dep:longint);
var
i,j,k:longint;
begin
if dep=3 then exit;
for i:=1 to 3 do
if (l[dep]=0) then
begin
ans:=ans+f[dep];
l[dep]:=1;
dfs(dep+1);
end;
end;
begin
readln(f[1],f[2]);
dfs(1);
writeln(ans);
end.
4.spfa
三个点,没两个点之间的边权位a和b,求出从1到3的最短路
type
arr=record
x,y,w,next:longint;
end;
var
edge:array[0..10000] of arr;
ls,t,state:array[0..100000] of int64;
exits:array[0..10000] of boolean;
i,j,k,n,m,q,p,o,s,l,a,b:longint;
procedure spfa;
var
head,tail,i,j:longint;
begin
state[1]:=0;
head:=0; tail:=1;
exits[1]:=true;
t[1]:=1;
repeat
inc(head);
i:=ls[t[head]];
while i<>0 do
begin
with edge[i] do
begin
if state[x]+w
Comments NOTHING