| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:超级无敌流氓打表法In Reply To:超级无敌流氓打表法 Posted by:luchenqun at 2010-08-06 21:22:48 > 首先,写个程序算出N=2,4,6,8,10时一共有多少张Lucky Tickets。
> 演示一个当N=10有多少张Lucky Tickets。
> #include<iostream>
> using namespace std;
> int main()
> {
> int count=0,a,b,c,d,e,f,g,h,i,j;
> for(a=0;a<=9;a++)
> for(b=0;b<=9;b++)
> for(c=0;c<=9;c++)
> for(d=0;d<=9;d++)
> for(e=0;e<=9;e++)
> for(f=0;f<=9;f++)
> for(g=0;g<=9;g++)
> for(h=0;h<=9;h++)
> for(i=0;i<=9;i++)
> for(j=0;j<=9;j++)
> if(a+b+c+d+e==f+g+h+i+j)
> count++;
> cout<<count<<endl;
> return 0;
> }
>
> 然后就是流氓打表法:
> #include<iostream>
> using namespace std;
> int main()
> {
> int a[]={0,10,670,55252,4816030,432457640},n;
> while(cin>>n)
> cout<<a[n/2]<<endl;
这个打表不对, 应该是这样的把:
10
10
100
670
6700
55252
552520
4816030
48160300
432457640
> return 0;
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator