Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Output Limit Exceeded求救!!!

Posted by zhongwen at 2011-07-16 13:11:14 on Problem 1384
我的程序就是说Output Limit Exceeded,不知为什么?大牛帮看看,感激不尽!!!


Source CodeProblem: 1384		User: zhongwen
Memory: N/A		Time: N/A
Language: C++		Result: Output Limit Exceeded

Source Code
#include <cstdio>
#include <cstring>

int ca , s , e , a[500][2] , f[10000] , m , n ;

int main()
{
    int i , j , k ;
    scanf( "%d" , &ca ) ;
    while ( ca )
    {
          scanf( "%d%d" , &s , &e ) ;
          n = e-s ;
          scanf( "%d" , &m ) ;
          memset( f , 127 , sizeof(f) ) ; f[0] = 0 ;
          for ( i = 0 ; i < m ; i++ ) 
              scanf( "%d%d" , &a[i][0] , &a[i][1] ) ;
          for ( i = 0 ; i < m ; i++ )
          for ( j = 0 ; j <= n ; j++ )
          if ( f[j] != 2139062143 )
          for ( k = 1 ; k <= n/a[i][1] ; k++ )
          if ( f[j+k*a[i][1]] > f[j]+k*a[i][0] ) f[j+k*a[i][1]] = f[j]+k*a[i][0] ;
          if ( f[n] == 2139062143 ) printf( "This is impossible.\n" ) ;
          else printf( "The minimum amount of money in the piggy-bank is %d.\n" , f[n] ) ;
    }       
} 

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator