166 条题解
-
0xusc_2009 LV 9 @ 2009-10-27 19:50:02
楼下某君着实没有道德。
另外就是枚举?并且不用打表就秒杀,这一点我还是很高兴的 -
02009-10-22 20:33:09@
var m,i,k,j,g,n:integer;
a:array[1..24] of integer;
d:array[1..24] of boolean;
p:array[0..4000] of integer;
s:string;
const b:array[0..9] of integer=(6,2,5,5,4,5,6,3,7,6);
procedure shu;
var i,j,f,x:integer;
begin
for i:=0 to 2000 do
begin
str(i,s);
for j:=1 to length(s) do
begin
val(s[j],f,x);
inc(p[i],b[f]);
end;
end;
end;
{===========main=============}
begin
shu;
for i:=0 to 1000 do
for j:=0 to 1000 do
begin
m:=i+j;
k:=p[i]+p[j]+p[m];
if k -
02009-10-22 17:45:07@
除了枚举MS没有其他算法
考场程序:
program matches;
const a1:array['0'..'9']of longint=(6,2,5,5,4,5,6,3,7,6);
var
a2:array[0..6000]of longint;
b:array[4..24]of longint;
s:string; i,j,k:longint;
begin
for i:=0 to 6000 do begin //calc i 's num of matches
str(i,s);
for j:=1 to length(s) do inc(a2[i],a1[s[j]]);
end;
for i:=0 to 3000 do
for j:=0 to 3000 do begin
k:=a2[i]+a2[j]+a2;
if k -
02009-10-21 19:03:22@
水题、只是去年这个时候的我比这个题还要水
-
02009-10-18 20:20:09@
楼下超长的题解可以删了。。
去年真伤啊。。
-
02009-10-06 15:10:44@
我强烈要求封楼下的号! 翻个题解累死人的!结果只看到打表两个字
-
02009-10-06 13:01:43@
楼下的楼下,过一题水题值得那么高兴么????????????
-
02009-10-03 10:23:36@
秒杀不了,又是300多ms,看来还是打表好啊
顺便说一句,楼下sb,鉴定完毕,强烈要求管理员封号,这些人就是vivid的冗余数据,每天闲的无聊发疯,无聊之极 -
02009-09-27 09:02:54@
program aa;
const data:array[0..9]of integer=(6,2,5,5,4,5,6,3,7,6);
var i,j,z,n,q:longint;
a:array[0..2000]of integer;
begin
for j:=0to 2000 do
begin
i:=j;
n:=0;
while i>9 do
begin
z:=i mod 10;
inc(n,data[z]);
i:=i div 10;
end;
inc(n,data[i]);
a[j]:=n;
end;
readln(n);
n:=n-4;
for i:=0to 1000 do
for j:=0to 1000 do
if a[i]+a[j]+a=n then inc(z);
write(z);
end. -
02009-09-23 17:51:43@
program matches;
const
num:array['0'..'9'] of integer=(6,2,5,5,4,5,6,3,7,6);
maxn=1000;var
f:array[0..maxn*2] of longint;
i,j,k,n,ans:longint;
s:string;
procedure init;
var
i,j,k:longint;
s:string;
begin
for i:= 0 to maxn*2 do
begin
str(i,s);
f[i]:=0;
for j:= 1 to length(s) do
inc(f[i],num[s[j]]);
end;
end;
begin
readln(n);
init;
ans:=0;
n:=n-4;
for i:= 0 to maxn do
begin
if f[i]>=n then continue;
for j:= 0 to maxn do
begin
if f[i]+f[j]>=n then continue;
k:=i+j;if f[i]+f[j]+f[k]=n then inc(ans);
end;
end;
write(ans);
end.
-
02009-09-19 20:45:13@
program p1496;
var
n:integer;
begin
read(n);
case n of
0:writeln(0);
1:writeln(0);
2:writeln(0);
3:writeln(0);
4:writeln(0);
5:writeln(0);
6:writeln(0);
7:writeln(0);
8:writeln(0);
9:writeln(0);
10:writeln(0);
11:writeln(0);
12:writeln(0);
13:writeln(1);
14:writeln(2);
15:writeln(8);
16:writeln(9);
17:writeln(6);
18:writeln(9);
19:writeln(29);
20:writeln(39);
21:writeln(38);
22:writeln(65);
23:writeln(88);
24:writeln(128);
end;
end.
还不打表?????? -
02009-09-19 12:00:39@
本来是for i:=0 to 999 怕超时 改成0 to 500(-. -!真不知道是怎么算的)
-
02009-09-18 22:24:42@
编译通过...
├ 测试数据 01:答案正确... 9ms
├ 测试数据 02:答案正确... 9ms
├ 测试数据 03:答案正确... 9ms
├ 测试数据 04:答案正确... 9ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 25ms
├ 测试数据 07:答案正确... 25ms
├ 测试数据 08:答案正确... 9ms
├ 测试数据 09:答案正确... 9ms
├ 测试数据 10:答案正确... 9ms -
02009-09-12 15:56:03@
这个题的答案貌似是没有规律的啊,大牛们怎么找到的??
难道是先编出来个程序 再得解吗?? -
02009-09-09 17:16:08@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0msconst
a:array[0..9] of longint=(6,2,5,5,4,5,6,3,7,6);
var
i,j,ans,n:longint;
function add(x:longint):longint;
var
k:longint;
begin
add:=0;
if x=0 then
exit(6);
while x0 do
begin
k:=x mod 10;
x:=x div 10;
add:=add+a[k];
end;
end;
begin
readln(n);
n:=n-4;
ans:=0;
for i:=0 to 1000 do
for j:=0 to 1000 do
if add(i)+add(j)+add(i+j)=n then
inc(ans);
writeln(ans);
end.Flag Accepted
题号 P1496
类型(?) 搜索
通过 1360人
提交 2417次
通过率 56%
难度 1提交 讨论 题解
-
02009-09-04 23:12:49@
交表
但是为什么在2个加数相同的时候算2种情况?
例如在枚举的时候会出现0+0=0的情况2次 结果也算2次?
我因此得90分.
-
02009-08-31 12:39:11@
水题不用打表
-
02009-08-29 09:52:44@
打表打表!!!!!
-
02009-08-20 21:50:07@
RP--……
居然交错了题……
水题用C写,呵呵。#include
int getnum(int n)
{
int t1,t2,t3,sum;
int num[10]={6,2,5,5,4,5,6,3,7,6};
t1=n/100;
t2=(n-t1*100)/10;
t3=n-t1*100-t2*10;
if (t1!=0) sum=num[t1]+num[t2]+num[t3]; else if
(t2!=0) sum=num[t2]+num[t3]; else sum=num[t3];
return sum;
}
int main(void)
{
int ta,tb,tc,k,i,j,n,no=0;
scanf ("%d",&n);
n=n-4;
for (i=0;i -
02009-08-19 13:54:31@
const
a:array[13..24] of longint=(1,2,8,9,6,9,29,39,38,65,88,128);
var
n:longint;
begin
readln(n);
if n