Page 1 of 1

10134 - AutoFish

Posted: Thu Dec 11, 2003 10:41 am
by erfan
Hello all helper,
From problem description i am not
clear about fish findind.
Please describe it's actual matter.
-------------------------------------------

Posted: Thu Dec 11, 2003 10:52 am
by zing
Yah actually it is not clear before
solve it.After solve it is more easy
then think before solve it.

1.You can get one fish when only you have minimum
two bait.If one fish get you must delete two bait.
2.You can get fish when you are now at position
of getting "fish".
3.You can get fish when you can get minimum seven
"fish+launch+bait".
4.Bait cannot increase more then six.

After satisfy all above four condition i had get
AC it.I think you also get AC it.
Hope it will help for you.

Posted: Thu May 31, 2007 9:50 pm
by Manu_bk
Have WA, need help
Here is my code.
I don't know if not understood very well the problem

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main() {
string s;
bool prim = true;
int pez =0;
int cebo = 0;
int instr = 0;
int pez_cmp = 0;
getline(cin,s);
getline(cin,s);
while(getline(cin,s)) {
if (s == "") {
if(!prim) cout <<endl;
prim = false;
cout << pez << endl;
pez = 0;
cebo = 0;
instr = 0;
pez_cmp = 0;
}
else {
++instr;
if (s == "bait" and cebo <= 5) ++cebo;
else if (s == "fish"){
if (pez == 0 and cebo >=2) {
++pez;
cebo -= 2;
instr = 0;
}
else if(pez != 0 and cebo >=2) {
++pez_cmp;
if (instr >= 7 and pez_cmp>=3) {
++pez;
cebo -=2;
instr = 0;
pez_cmp = 0;
}
}
}
}
}
}