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 1296. Hyperjump

Отчего compile eror? на dev-cpp компилиться
Posted by Uran 31 Mar 2007 00:45
#include <iostream.h>
#include <iostream>
int main()
{
    using namespace std ;
    const int c=60000;
    long long a[c],i,j,n,ans;
    a[0]=0;
    cin>>n;
    for (i=1;i<n+1;i++){cin>>a[i];a[i]=a[i-1]+a[i];}
    ans=0;
    for (i=1;i<n+1;i++){for (j=i;j<n+1;j++){if (a[j]-a[i-1]>ans){ans=a[j]-a[i-1];}}}
    cout<<ans;
    return 0;
}
Re: Отчего compile eror? на dev-cpp компилиться
Posted by [SPbSU ITMO] WiNGeR 31 Mar 2007 02:09
Use __int64 instead of long long. And read FAQ, there is a lot of different useful information about avoiding compilation error
Re: Отчего compile eror? на dev-cpp компилиться
Posted by Romko [Lviv NU] 1 Apr 2007 17:23
Here is your compiling code:
#include <iostream>
using namespace std;
int main()
{
using namespace std ;
const int c=60000;
long long a[c],i,j,n,ans;
a[0]=0;
cin>>n;
for (i=1;i<n+1;i++){cin>>a[i];a[i]=a[i-1]+a[i];}
ans=0;
for (i=1;i<n+1;i++){for (j=i;j<n+1;j++){if (a[j]-a[i-1]>ans){ans=a[j]-a[i-1];}}}
cout<<ans;
return 0;
}