11247 - Income Tax

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

Moderator: Board moderators

Wei-Ming Chen
Experienced poster
Posts: 122
Joined: Sun Nov 13, 2005 10:25 am
Location: Taiwan

Post by Wei-Ming Chen »

I removed double and got Accpted :)

Thanks emotional blind

hi!man!
New poster
Posts: 48
Joined: Fri Dec 29, 2006 1:26 pm

Post by hi!man! »

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

emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Location: Bangladesh
Contact:

Post by emotional blind »

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

Wei-Ming Chen
Experienced poster
Posts: 122
Joined: Sun Nov 13, 2005 10:25 am
Location: Taiwan

Post by Wei-Ming Chen »

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 :)

hi!man!
New poster
Posts: 48
Joined: Fri Dec 29, 2006 1:26 pm

Post by hi!man! »

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~

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

Post by hamedv »

wath's the out put for 99 99?

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

Post by pvncad »

9799

jan_holmes
Experienced poster
Posts: 136
Joined: Fri Apr 15, 2005 3:47 pm
Location: Singapore
Contact:

Post by jan_holmes »

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_back

typedef 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;
}

emotional blind
A great helper
Posts: 383
Joined: Mon Oct 18, 2004 8:25 am
Location: Bangladesh
Contact:

Post by emotional blind »

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

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

Post by cytmike »

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

if (v<m)
cout<<"Not found\n";
else
cout<<v<<endl;
Impossible is Nothing.

mohsincsedu
Learning poster
Posts: 63
Joined: Tue Sep 20, 2005 12:31 am
Location: Dhaka
Contact:

Post by mohsincsedu »

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

Wei-Ming Chen
Experienced poster
Posts: 122
Joined: Sun Nov 13, 2005 10:25 am
Location: Taiwan

Post by Wei-Ming Chen »

Yes it is.

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

Post by joeluchoa »

I've got still WA! :cry:

Please, help me.

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]

Wei-Ming Chen
Experienced poster
Posts: 122
Joined: Sun Nov 13, 2005 10:25 am
Location: Taiwan

Post by Wei-Ming Chen »

Try to avoid using double

bhuwan.chopra
New poster
Posts: 3
Joined: Sun Aug 05, 2007 10:58 pm

Please find the mistake in below code!

Post by bhuwan.chopra »

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.

Post Reply

Return to “Volume 112 (11200-11299)”