P1008 三连击 代码:
总:优美的暴力或打表。var i,j,a,b,c:longint; v:array [0..10] of boolean; f:boolean;begin for i:=123 to 345 do begin fillchar(v,sizeof(v),0); a:=i; b:=i*2; c:=i*3; for j:=1 to 3 do begin v[a mod 10]:=true; v[b mod 10]:=true; v[c mod 10]:=true; a:=a div 10; b:=b div 10; c:=c div 10; end; f:=true; for j:=1 to 9 do f:=f and v[j]; if f then writeln(i,' ',i*2,' ',i*3); end;{ writeln('192 384 576'); writeln('219 438 657'); writeln('273 546 819'); writeln('327 654 981');}end.
P1035 级数求和 代码:
总:暴力。var a:real; s,i,n:longint;begin readln(n); i:=2; a:=1; s:=1; while a<=n do begin a:=a+1/i; s:=s+1; i:=i+1; end; write(s);end.
P1307 数字反转 代码:
总:字符串倒着输出。var s:string; l,i:longint;begin readln(s); if s[1]='-' then begin write('-'); delete(s,1,1); end; l:=length(s); while (s[l]='0') and (l>1) do dec(l); for i:=l downto 1 do write(s[i]);end.
P1423 小玉在游泳 代码:
总:暴力。var i:longint; n,m:real;begin read(n); m:=2; i:=0; while n>0 do begin n:=n-m; m:=m*0.98; inc(i); end; write(i);end.
P1424 小鱼的航程(改进版)
总:暴力。var n,m,ans:longint;begin readln(n,m); ans:=0; while m>0 do begin if n>7 then n:=n-7; dec(m); if n<6 then ans:=ans+250; inc(n); end; write(ans);end.
P1980 计数问题
总:同上。var n,i,l,j,m:longint; a:array ['0'..'9'] of longint; s:string;begin read(n,m); for i:=1 to n do begin str(i,s); l:=length(s); for j:=1 to l do inc(a[s[j]]); end; write(a[chr(m+48)]);end.
总结:
暴力出正解。(都是水题啊)