回到高中

公式是网上查的,求图形 中各种型号的长方形,正方形的数量

 

#include <stdio.h>

  int  main()

  {

long long s2,r2,s3,r3,s4,r4,N;

  while (scanf("%lld",&N)!=EOF)

   {

     s2=N*(N+1)*(2*N+1)/6;

      r2=(N+1)*N*N*(N+1)/4;

      s3=r2;

     r3=(N+1)*N*N*(N+1)*N*(N+1)/8;

     s4=(6*N*N*N*N*N+15*N*N*N*N+10*N*N*N-N)/30;

     r4=(N+1)*N*N*(N+1)*N*(N+1)*N*(N+1)/16;  公式不知道,看百度 的

   printf("%lld %lld %lld %lld %lld %lld\n",s2,r2-s2,s3,r3-s3,s4,r4-s4);   } 

 return 0;

} http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=13&problem=1118&mosmsg=Submission+received+with+ID+11324386

posted @ 2013-02-28 19:03  L kill  阅读(159)  评论(0编辑  收藏  举报