## 11247 - Income Tax Hazard

Moderator: Board moderators

I removed double and got Accpted

Thanks emotional blind
Wei-Ming Chen
Experienced poster

Posts: 122
Joined: Sun Nov 13, 2005 10:25 am
Location: Taiwan

sclo wrote:even if v==m, the solution v is still valid.

I don't think so.

Given the value of m and x, you will have to find the value of the maximum income v, which is effectively (after deducting the tax) less than someone earning less than v.

According to problem statement, v must bigger than m.
If I am wrong, correct me.

PS. I change
Code: Select all
`if(n<=m)   puts("Not found"); `

to
Code: Select all
`if(n<m)   puts("Not found"); `

still WA....
hi!man!
New poster

Posts: 48
Joined: Fri Dec 29, 2006 1:26 pm

even if v==m its effective income may less then m-1,
so solution v is valid as i think.

emotional blind
A great helper

Posts: 383
Joined: Mon Oct 18, 2004 8:25 am

To hi!man!

For input "100 67", your code outputs 300

But I think the answer is 299

by the way, I think
if(n*100%(100-x)==0)
n--;
exist a problem

Hope it helps
Wei-Ming Chen
Experienced poster

Posts: 122
Joined: Sun Nov 13, 2005 10:25 am
Location: Taiwan

emotional blind wrote:even if v==m its effective income may less then m-1,
so solution v is valid as i think.

sorry, you are right.
Wei-Ming Chen wrote:To hi!man!

For input "100 67", your code outputs 300

But I think the answer is 299

by the way, I think
if(n*100%(100-x)==0)
n--;
exist a problem

Hope it helps

Thanks, it really help me
I change that and got AC~
hi!man!
New poster

Posts: 48
Joined: Fri Dec 29, 2006 1:26 pm

wath's the out put for 99 99?
hamedv
Learning poster

Posts: 98
Joined: Mon May 07, 2007 8:30 am

9799
New poster

Posts: 27
Joined: Sun Feb 18, 2007 2:14 pm

What's wrong with my code :

Code: Select all
`#include <iostream>#include <bitset>#include <algorithm>#include <cstdio>#include <cstdlib>#include <string>#include <cstring>#include <vector>#include <map>#include <queue>#include <deque>#include <stack>#include <cctype>#include <set>#include <cmath>#include <climits>#include <sstream>#include <fstream>#include <list>#include <functional>#include <utility>#include <iomanip>#include <ctime>using namespace std;#define SZ size()#define pp push_backtypedef long long LL;typedef vector <int> vi;typedef vector <double> vd;typedef vector <vi> vvi;typedef vector <string> vs;typedef pair<int,int> pii;typedef vector <LL> vll;int main () {    int n,m;    while (scanf("%d %d",&n,&m) != EOF) {          if (!n && !m) return 0;          if (m==100 || m == 0 || n == 1) { printf("Not Found\n"); continue;}          double temp = (double)m/100.0;          temp = 1.0-temp;          temp = (n-1) / temp;          int ret = (int) temp;          ret++;          if (ret < n) { printf("Not Found\n"); continue;}          bool stat = false;          while (true) {                double t = (ret*((double)1-m/100.0));                //cout << ret << " " << t << "\n";                if (t < ((double)n-1) && ret >= n) { printf("%d\n",ret); stat = true; break;}                ret--;                if (ret < n) break;          }          if (!stat) printf("Not Found\n");    }    return 0;}`
jan_holmes
Experienced poster

Posts: 136
Joined: Fri Apr 15, 2005 3:47 pm
Location: Singapore

Too Complex Code for a simple problem..

v < 100*(m-1)/(100-x)
[spoiler ? then i will remove it]

it is enough.. and can be solved without using double..

emotional blind
A great helper

Posts: 383
Joined: Mon Oct 18, 2004 8:25 am

To everybody who got stuck, it is necessary to check whether you calculated v is larger than or equal to m.

if (v<m)
else
cout<<v<<endl;
Impossible is Nothing.

cytmike
Learning poster

Posts: 95
Joined: Mon Apr 26, 2004 1:23 pm
Location: Hong Kong and United States

what's the output for input: 51 2
is it: 51?????
Amra korbo joy akhdin............................
mohsincsedu
Learning poster

Posts: 63
Joined: Tue Sep 20, 2005 12:31 am
Location: Dhaka

Yes it is.
Wei-Ming Chen
Experienced poster

Posts: 122
Joined: Sun Nov 13, 2005 10:25 am
Location: Taiwan

I've got still WA!

My code answer correct all post's cases.

Code: Select all
`Remove after AC`
Last edited by joeluchoa on Tue Aug 07, 2007 10:59 pm, edited 1 time in total.
http://acm.uva.es/problemset/usersnew.php?user=47903

All men are like grass,and all their
glory is like the flowers of the field;
the grass withers and the flowers fall,
but the word of the Lord stands forever.
[1 Peter 1:24-25]

joeluchoa
New poster

Posts: 28
Joined: Sat Jul 31, 2004 12:11 am
Location: Brasil

Try to avoid using double
Wei-Ming Chen
Experienced poster

Posts: 122
Joined: Sun Nov 13, 2005 10:25 am
Location: Taiwan

### Please find the mistake in below code!

It solved my problem. Thanks a lot for the help.
Thanks,
Last edited by bhuwan.chopra on Mon Aug 06, 2007 9:18 am, edited 1 time in total.
bhuwan.chopra
New poster

Posts: 3
Joined: Sun Aug 05, 2007 10:58 pm

PreviousNext