Moderator: Board moderators

yauyau
New poster
Posts: 2
Joined: Wed Jul 17, 2002 12:20 pm
Location: HKSAR---HONG KONG

I try to solve 10300 but I dun understand the relation between the output and the input.... I have read the question and I think in this way:

SAMPLE INPUT
1
3
1 1 1
2 2 2
3 3 3

Then the sample output is calculated by:
[(1*1*1)+(2*2*2)+(3*3*3)] / 3

SAMPLE OUTPUT
12

but of course, I have misunderstand the question and I still can't figure out what's the meaning of "summed burden".......
May u help me?

I have only done little acm questions and want to choose some simple one for practice, but it seems that I have difficulties in understanding the question........ ><

soyoja
Experienced poster
Posts: 106
Joined: Sun Feb 17, 2002 2:00 am
Location: Seoul, South Korea
Contact:

I think that 10300 is one of the easiest problem in Valladolid problem

First you need the space a single animal occupies at an average. This value (in square meters) is then multiplied by the parameter that stands for the farmer's environment-friendliness, resulting in the premium a farmer is paid per animal he owns. To compute the final premium of a farmer just multiply this premium per animal with the number of animals the farmer owns.
Problem said " We won't make a difference between different

animals, although this is far from reality". So You have only calculate

( size of farmyard * environment-friendliness). And sum of total

value is answer. Confirm it yourself. ^^

yauyau
New poster
Posts: 2
Joined: Wed Jul 17, 2002 12:20 pm
Location: HKSAR---HONG KONG
OH! I understand now~~~
thanks~~~~~

Master
Learning poster
Posts: 82
Joined: Thu Oct 10, 2002 1:15 pm
Contact:

### 10300 &#8211; Incorrect output with AC code again.

Hi every body,
I have found another problem whose judge input is not appropriate. It gives an incorrect output with the following input.

1
5
100000 1 100000
100000 1 100000
100000 1 100000
100000 1 100000
100000 1 100000

it gives output,
7050327040

But the input can be more large.

Here is my code

Dear Old Sailor:

You are trying to solve "Ecological Premium" (problem 10300).
I have received and stored your C++ program. It will be compiled and
run
as soon as possible; please be patient waiting for the results...

--
The Online Judge

--------------- The program I'll compile begins here: ---------------
[cpp]#include<stdio.h>
main(void)
{ long int l,a,p;
int t,f;
double bjt;
// freopen("in.in","rt",stdin);
scanf("%d",&t);
for(;t>0;t--)
{ bjt=0;
scanf("%d",&f);
for(;f>0;f--)
{ scanf("%ld %ld %ld",&l,&a,&p);
bjt += l*p; //Here should be used casting
}
printf("%.0lf",bjt);
// if(t!=1)
putchar('\n');
}
return 0;
}[/cpp]

What’s going on here….

M H Rasel
CUET – Old Sailor
[/cpp]

New poster
Posts: 2
Joined: Thu Mar 04, 2004 1:40 am
Location: Portugal

### l:. Presentation Error

in 0.000 seconds with low memory spent.
Congratulations!

Warning: Your program would get a Presentation Error in a true contest.
The 24-hours judge interpretes it as an "Accepted" problem.
I don't know what error my program has...
does anyone else had this PE message?

Lukas
New poster
Posts: 1
Joined: Wed Jun 22, 2005 12:56 am

### Restricted Methods again

Hi,

I have tried to submit 3 different Tasks the last couple of days. I always got a "Restricted Function" Error. I tried REALLY to use only minimalistic functions, no chance. I even kicked StringBuffer().

One of the most frustrating things is that I don't have permission to read the sample code you provided! We're holding a competition at university this friday and I don't even have a CHANCE for practicing...

The only thing I like to know (like many other people using Java, i think) is which functions are allowed and which are not.

Here's my code I submitted for problem #10300
Sorry if it looks bad, I would do it much better if it would be allowed!

import java.io.*;

class Main {

public static void main(String args[]) {
Eco ec = new Eco();
ec.start();
}

}

class Eco {

public void start() {

//System.out.println("opened Stream");
work(isr);

return;
}

try {

for (int i=0; i<testcases; i++) {

int sum = 0;

for(int j=0; j < farmers; j++) {
int[] val = new int[3];
sum=sum+val[0]*val[2];
}

System.out.println(sum);
}
} catch (IOException e) {
System.err.println(e);
}
return;
}

public int[] giveints(String in) {

String out = "";
int pos = 0;
int[] val = new int[3];

for (int k=0; k<in.length(); k++) {

if (in.charAt(k) != ' ') {
out = out.concat(String.valueOf(in.charAt(k)));
//System.out.println("appending char "+in.charAt(k));
} else {
val[pos] = Integer.parseInt(out);
pos++;
//System.out.println("read Integer "+val[pos-1] + " out of " + out.toString());
out = "";
}

}
val[pos] = Integer.parseInt(out);
//System.out.println("read Integer "+val[pos] + " out of " + out.toString());

return(val) ;

}

String in = "";

boolean EOL = false;

try {

do {

// System.out.println("Gotchar: "+c );
if( ! ((c=='\n' || c=='\r') && in=="")) {
if (c=='\n' || c=='\r') {
EOL = true;
} else {
in = in.concat(String.valueOf(c));
}
}
} while (! EOL);

} catch (IOException e) {
System.err.println(e);

}
// System.out.println("GotLine: "+in );
return(in);

}

}

What's wrong? InputStreamReader(), Integer(), a String-Method?? I'm really frustrated!

Lukas

chunyi81
A great helper
Posts: 293
Joined: Sat Jun 21, 2003 4:19 am
Location: Singapore
Methods from Integer functions are allowed. I have had my frustrations with Java in UVA before. The most likely culprit is InputStreamReader. Try doing without that. System.in is fine.

Roby
Experienced poster
Posts: 101
Joined: Wed May 04, 2005 4:33 pm
Location: Tangerang, Banten, Indonesia
Contact:

### 10300 PE

Can somebody helps me to find what's wrong with my code below:

Code: Select all

``````#include <stdio.h>

typedef long long llong;

int main()
{
int n = 0, f = 0, i = 0, j = 0;
llong a = 0, b = 0, c = 0, sum = 0;

scanf( "%d", &n );

for ( i = 0; i < n; i++ )
{
if ( i )
printf( "\n" );

scanf( "%d", &f );

for ( j = 0, sum = 0; j < f; j++ )
{  scanf( "%lld %lld %lld", &a, &b, &c );
( j == 0 ) ? ( sum = a * c ) : ( sum += a * c );
}

printf( "%lld", sum );
}

return 0;
}
``````
Here's the input I used:

Code: Select all

``````3
5
1 1 1
2 2 2
3 3 3
2 3 4
8 9 2
3
9 1 8
6 12 1
8 1 1
3
10 30 40
9 8 5
100 1000 70
``````
and here's the output that my programme produced:

Code: Select all

``````38
86
7445
``````
It's really similar with the test input and output, isn't it?
I really confused with this.

chuzpa
New poster
Posts: 33
Joined: Fri Jun 18, 2004 8:39 am
Location: Mexico
Contact:
avoid ...

Code: Select all

`````` if ( i )
printf( "\n" );
``````
And just write ..

Code: Select all

`````` printf("%lld\n",sum);
``````

amine.hamdaoui
New poster
Posts: 10
Joined: Tue Aug 07, 2007 7:33 pm

### 10300 - WA why?

I think i have solved the 10300 problem, but why do i get the famous Wrong Answer ? there is my C++ code :

Code: Select all

``````#include <iostream>

using namespace std;

int main()
{
long nb_case,nb_farmers,sum,farmsize,nb_animal,friendliness,i,j;

cin>>nb_case;
for(i=0 ; i<nb_case ; i++)
{
sum=0;
cin>>nb_farmers;
for(j=0 ; j<nb_farmers ; j++)
{
cin>>farmsize>>nb_animal>>friendliness;
sum += (friendliness*farmsize);
}
cout<<sum;
if(i!=(nb_case-1)) cout<<endl;
}

return 0;
}
``````
Does some have an idea? I'm blocked!!!

mmonish
Experienced poster
Posts: 109
Joined: Sun Mar 11, 2007 2:55 pm
Location: SUST
U should output a newline after each output.

Code: Select all

``````cout<<sum;
if(i!=(nb_case-1)) cout<<endl;``````
Use

Code: Select all

``cout << sum << endl;``
Better u can use long long.

Hope this helps.

hridoy
New poster
Posts: 21
Joined: Tue May 08, 2007 10:30 am
Location: Dhaka
Contact:

### acm-10300(CE)

Can anyonw please tell me why I m getting CE in this prob??

Code: Select all

``````//------- 10300 ------- //
#include<iostream>
using namespace std;

void main(void)
{
long n,m,m1,m2,m3,i,j,s;
//scanf("%ld",&n);
cin>>n;
for(i=0;i<n;i++)
{
s=0;
cin>>m;
for(j=0;j<m;j++)
{
cin>>m1>>m2>>m3;
s+=(m1*m3);
}
cout<<s<<endl;
}
}
``````

CMG
New poster
Posts: 37
Joined: Sat Dec 08, 2007 5:01 am
Location: ...
shouldn't it be:

Code: Select all

``````int main() {
....
return 0;
}
``````

lnr
Experienced poster
Posts: 141
Joined: Sat Jun 30, 2007 2:52 pm

This is a easy problem.

lnr
Experienced poster
Posts: 141
Joined: Sat Jun 30, 2007 2:52 pm

### Re: 10300 - Ecological Premium

Hridoy wrote:
Can anyonw please tell me why I m getting CE in this prob??
//------- 10300 ------- //
#include<iostream>
using namespace std;

void main(void)
{
long n,m,m1,m2,m3,i,j,s;
//scanf("%ld",&n);
cin>>n;
for(i=0;i<n;i++)
{
s=0;
cin>>m;
for(j=0;j<m;j++)
{
cin>>m1>>m2>>m3;
s+=(m1*m3);
}
cout<<s<<endl;
}
}
Yes use
int main()
{
return 0;
}
It may help.