1 / 2
Apr 2011

hello sir
I want to know the pointing criteria of the spoj.
I submitted a solution of TRICOUNT with this logic and got 0.1 point

#include<stdio.h>
int main()
{
    long long t,n,res3,res,res1,num,i;
    scanf("%lld",&t);
    for(i=0;i<t;i++)
    {
         res3=0;
         scanf("%lld",&num);
         n=(num/2)-1;
         res1=(num*num)+((num-1)*(num)*(num+1))/6;   
         if(num>3 && num%2==0)     res3=(n*(n+1)*((4*n)-1))/6;
         else if(num>3 && num%2!=0) res3=(n*(n+1)*((4*n)+5))/6;
         res=res1+res3;
         printf("%lld\n",res);
   }
   return 0;
}

again I reduce the code it is also accepted in spoj but didnt achieve any point with this code--dont know the reason why this happen as this code is more easy and simple

#include<stdio.h>
int main()
{
    long long n,res,t,i;
    scanf("%lld",&t);
    for(i=0;i<t;i++)
    {
    scanf("%lld",&n);
    if(n%2==0)
              res=(n*(n+2)*(2*n+1))/8;
    else 
              res=((n+1)*(2*n*n+3*n-1))/8;
    printf("%lld\n",res);
    }
    return 0;
}

I want to know the pointing rule and also if one solution is accepted with less point , can I get more points in the same problem with better code.

  • created

    Apr '11
  • last reply

    Apr '11
  • 1

    reply

  • 228

    views

  • 2

    users

  • 1

    link

Suggested Topics

Want to read more? Browse other topics in Off-topic or view latest topics.