166 条题解
-
0wddwxy LV 10 @ 2009-01-03 22:34:31
- -
都是牛人
挤到这么靠后了
- -
-
02008-12-18 15:34:28@
都是牛人啊~~我也留个名~~
-
02008-12-15 20:30:05@
看见牛人(FDhyc)我也留个名
-
02008-12-13 10:18:11@
牛题我也留个名
-
02009-01-04 18:58:27@
编译通过...
├ 测试数据 01:答案正确... 150ms
├ 测试数据 02:答案正确... 119ms
├ 测试数据 03:答案正确... 119ms
├ 测试数据 04:答案正确... 166ms
├ 测试数据 05:答案正确... 150ms
├ 测试数据 06:答案正确... 134ms
├ 测试数据 07:答案正确... 150ms
├ 测试数据 08:答案正确... 134ms
├ 测试数据 09:答案正确... 134ms
├ 测试数据 10:答案正确... 134ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:1390ms这水题明显穷举
-
02008-12-12 18:17:21@
??????
-
02008-12-12 16:45:09@
来个藤椅吧
-
02008-12-12 13:07:24@
连地板都没有!
-
02008-12-12 09:36:19@
???
-
02008-12-11 23:15:57@
题目无显示?
-
-12017-03-15 16:32:04@
暴力枚举就可以过,注意数据中A(B)(C)最多可以构造到三位数。
-
-12016-07-17 11:26:17@
#include <iostream>
int a[10]={6,2,5,5,4,5,6,3,7,6};
int result=0;int v(int k){
int s=0;
do{
s+=a[k%10];
k=k/10;
}while(k);
return s;
}using namespace std;
int main(){
int n;
cin>>n;
n=n-4;
int x,y,z;
for(x=0;x<=1000;x++)
for(y=0;y<=1000;y++){
z=x+y;
if(v(x)+v(y)+v(z)==n)
result++;
}cout<<result;
return 0;
} -
-12016-07-13 15:43:03@
水水的枚举竟然也能过……
```pascal
program match;
const
sum:array[0..9]of integer=(6,2,5,5,4,5,6,3,7,6);
var n,num,i,j,t,ans:longint;function add(s:longint):longint;
var t:longint;
begin
t:=s;
add:=0;
while t div 10<>0 do
begin
add:=add+sum[t mod 10];
t:=t div 10;
end;
add:=add+sum[t];
end;begin
readln(n);
for i:=0 to 720 do
for j:=0 to 720 do
begin
t:=i+j;
if add(i)+add(j)+add(t)=n-4 then inc(ans);
end;
writeln(ans);
end.
``` -
-12016-07-06 10:51:13@
懒得想,直接枚举了。虽然时间较多。。。
~~~
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N=1112;
char st[12];
int n,ans,A[10]={6,2,5,5,4,5,6,3,7,6};
int count(){
int c=0;
for(unsigned i=0;i<strlen(st);i++){
if(st[i]>='0'&&st[i]<='9') c+=A[st[i]-'0'];
}
return c;
}
int main(){
scanf("%d",&n);
n-=4;
int ci,cj,ca;
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
sprintf(st,"%d",i);ci=count();
sprintf(st,"%d",j);cj=count();
sprintf(st,"%d",i+j);ca=count();
if(ci+cj+ca==n) ans++;
}
}
printf("%d\n",ans);
return 0;
} -
-12016-07-01 14:06:12@
编译成功
foo.cpp: In function 'int main()':
foo.cpp:25:17: warning: unused variable 'x1' [-Wunused-variable]
int k=i+j,x1,x2,x3;
^
foo.cpp:25:20: warning: unused variable 'x2' [-Wunused-variable]
int k=i+j,x1,x2,x3;
^
foo.cpp:25:23: warning: unused variable 'x3' [-Wunused-variable]
int k=i+j,x1,x2,x3;
^
测试数据 #0: Accepted, time = 0 ms, mem = 576 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 580 KiB, score = 10
测试数据 #2: Accepted, time = 15 ms, mem = 576 KiB, score = 10
测试数据 #3: Accepted, time = 0 ms, mem = 572 KiB, score = 10
测试数据 #4: Accepted, time = 0 ms, mem = 576 KiB, score = 10
测试数据 #5: Accepted, time = 15 ms, mem = 572 KiB, score = 10
测试数据 #6: Accepted, time = 0 ms, mem = 576 KiB, score = 10
测试数据 #7: Accepted, time = 15 ms, mem = 576 KiB, score = 10
测试数据 #8: Accepted, time = 15 ms, mem = 576 KiB, score = 10
测试数据 #9: Accepted, time = 15 ms, mem = 572 KiB, score = 10
Accepted, time = 75 ms, mem = 580 KiB, score = 100
代码
#include <iostream>
#include <cstring>
#include <queue>
#include <cstdio>
using namespace std;
int sum[5001]={6,2,5,5,4,5,6,3,7,6};
int main()
{
int i,j,n,ans=0;
cin>>n;
n-=4;
for (i=0;i<5001;i++)
{
if (i>=10 && i<100)
sum[i]=sum[i/10]+sum[i%10];
if (i>=100 && i<1000)
sum[i]=sum[i/100]+sum[(i%100)/10]+sum[i%10];
if (i>=1000)
sum[i]=sum[i/1000]+sum[(i%1000)/100]+sum[(i%100)/10]+sum[i%10];
}
for (i=0;i<2222;i++)
{
for (j=0;j<2222;j++)
{
int k=i+j,x1,x2,x3;
if (sum[i]+sum[j]+sum[k]==n)
{
ans++;
}
}
}
cout<<ans;
}
-
-12016-06-04 16:17:12@
include <stdio.h>
int a[25] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,8,9,6,9,29,39,38,65,88,128};
int main (void)
{
int n;
scanf("%d",&n);
printf("%d\n",a[n]);
return 0;
}
水过去!!! -
-12016-04-04 16:06:13@
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;int n,ans;
int num[2225]={6,2,5,5,4,5,6,3,7,6};void init()
{int i;
scanf("%d",&n);
ans=0;
for (i=10;i<=2224;i++)//计算出数i需要的火柴棒根数
if (i>=10&&i<=99)//i是两位数
num[i]=num[i/10]+num[i%10];
else
if (i>=100&&i<=999)//i是三位数
num[i]=num[i/100]+num[(i%100)/10]+num[i%10];
else//i是四位数
num[i]=num[1]+num[(i%1000)/100]+num[(i%100)/10]+num[i%10];
}void work()
{int i,j;
for (i=0;i<=1111;i++)//枚举两个加数i和j
for (j=0;j<=1111;j++)
if (num[i]+num[j]+num[i+j]==n-4) ans++;
printf("%d\n",ans);
}int main()
{//freopen("matches.in","r",stdin);
//freopen("matches.out","w",stdout);
init();
work();
return 0;
} -
-12016-03-23 00:35:28@
测试数据 #0: Accepted, time = 0 ms, mem = 552 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 552 KiB, score = 10
测试数据 #2: Accepted, time = 0 ms, mem = 552 KiB, score = 10
测试数据 #3: Accepted, time = 15 ms, mem = 548 KiB, score = 10
测试数据 #4: Accepted, time = 0 ms, mem = 548 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 552 KiB, score = 10
测试数据 #6: Accepted, time = 15 ms, mem = 552 KiB, score = 10
测试数据 #7: Accepted, time = 0 ms, mem = 548 KiB, score = 10
测试数据 #8: Accepted, time = 0 ms, mem = 552 KiB, score = 10
测试数据 #9: Accepted, time = 0 ms, mem = 548 KiB, score = 10
Accepted, time = 30 ms, mem = 552 KiB, score = 100 -
-12016-03-17 20:36:38@
-
-12016-03-16 22:10:11@
暴力AC 233333333
测试数据 #0: Accepted, time = 937 ms, mem = 804 KiB, score = 10
测试数据 #1: Accepted, time = 937 ms, mem = 804 KiB, score = 10
测试数据 #2: Accepted, time = 953 ms, mem = 804 KiB, score = 10
测试数据 #3: Accepted, time = 953 ms, mem = 808 KiB, score = 10
测试数据 #4: Accepted, time = 937 ms, mem = 808 KiB, score = 10
测试数据 #5: Accepted, time = 953 ms, mem = 808 KiB, score = 10
测试数据 #6: Accepted, time = 953 ms, mem = 808 KiB, score = 10
测试数据 #7: Accepted, time = 937 ms, mem = 804 KiB, score = 10
测试数据 #8: Accepted, time = 937 ms, mem = 804 KiB, score = 10
测试数据 #9: Accepted, time = 953 ms, mem = 804 KiB, score = 10
Accepted, time = 9450 ms, mem = 808 KiB, score = 100type int=longint; var i,j,k,n,ans,x:int; b:array[0..9]of int=(6,2,5,5,4,5,6,3,7,6); a:array[0..721]of int; s:string; begin readln(n); n:=n-4; ans:=0; for i:=0 to 9 do a[i]:=b[i]; for i:=10 to 720 do begin a[i]:=0; str(i,s); for j:=1 to length(s) do begin val(s[j],x); a[i]:=a[i]+a[x]; end; end; for i:=0 to 720 do for j:=0 to 720 do for k:=0 to 720 do if (a[i]+a[j]+a[k]=n)and(i+j=k) then inc(ans); writeln(ans); readln; end.