10134 - AutoFish

All about problems in Volume 101. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
erfan
New poster
Posts: 44
Joined: Tue Apr 15, 2003 4:31 pm
Location: Chittagong,Bangladesh
Contact:

10134 - AutoFish

Post by erfan »

Hello all helper,
From problem description i am not
clear about fish findind.
Please describe it's actual matter.
-------------------------------------------
zing
New poster
Posts: 3
Joined: Wed Dec 10, 2003 8:44 am

Post 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.
zingzung
Manu_bk
New poster
Posts: 2
Joined: Fri May 25, 2007 5:16 pm

Post 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;
}
}
}
}
}
}
Post Reply

Return to “Volume 101 (10100-10199)”