Page 2 of 4

Posted: Sun Jul 29, 2007 9:44 am
by Wei-Ming Chen
I removed double and got Accpted :)

Thanks emotional blind

Posted: Sun Jul 29, 2007 9:52 am
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....

Posted: Sun Jul 29, 2007 9:55 am
by emotional blind
even if v==m its effective income may less then m-1,
so solution v is valid as i think.

Posted: Sun Jul 29, 2007 10:04 am
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 :)

Posted: Sun Jul 29, 2007 10:32 am
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~

Posted: Sun Jul 29, 2007 11:09 am
by hamedv
wath's the out put for 99 99?

Posted: Sun Jul 29, 2007 11:22 am
by pvncad
9799

Posted: Sun Jul 29, 2007 12:09 pm
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;
}

Posted: Sun Jul 29, 2007 5:37 pm
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..

Posted: Sun Jul 29, 2007 6:35 pm
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;

Posted: Thu Aug 02, 2007 5:09 am
by mohsincsedu
what's the output for input: 51 2
is it: 51?????

Posted: Thu Aug 02, 2007 9:34 am
by Wei-Ming Chen
Yes it is.

Posted: Fri Aug 03, 2007 4:38 am
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

Posted: Sat Aug 04, 2007 6:36 am
by Wei-Ming Chen
Try to avoid using double

Please find the mistake in below code!

Posted: Sun Aug 05, 2007 11:00 pm
by bhuwan.chopra
It solved my problem. Thanks a lot for the help.
Thanks,