ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1114. Boxes

Why I got CE
Posted by Alabaster 23 Jun 2002 20:57
Please write wha am I getting CE:
// Boxes
#include <iostream.h>
#include <math.h>

int n, a, b;
long num=0;

int min(int a, int b)
{
 if (a<b) return a;
 else return b;
}

int c(int il)
{
 if (min(a, b)>il)
  return il+1;
 else return min(a, b)+1;
}

int count()
{
 int i;
 for (i=a+b; i>=0; i--)
 {
  num += c(min(i, a+b-i)) * long(pow(double(n), double(i)));
 }
 cout << num;
}

int main()
{
 cin >> n >> a >> b;
 count();
 return 0;
}
Re: Why I got CE
Posted by 55555 1 Aug 2003 14:13
coercive conversion must like this (long)pow(n,i).
but your porgram is also WA.