Tip : All you need to do is to find a formula for Effective Income of person . Here Effective Income simply means the Minimum Amount you have to earn Which will be greater than ' M ' but after giving tax it'll be less than ' M ' . If ' X ' is 100 then the result won't be evaluated. That means " No solution " will return. If not then find the income using the Formula you have . If the result is FRACTIONAL then hold here . If NOT then DECREASE the result by ' 1 '. Now check weather It's GREATER than ' M ' or Not . If GREATER than M then print it . If NOT then print " No solution ".
!!! Warning : Use ' long long int ' . Don't use " double " data type . Move to Code now.
Code :
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long int m,income;
int x;
while(scanf("%lld %d",&m, &x)==2)
{
if(m==0 && x==0) break;
if(x==100)
printf("Not found\n");
else
{
income = (m-1)*100/(100-x);
if((m-1)*100%(100-x)==0)
income = income - 1;
if(income<m)
printf("Not found\n");
else
printf("%lld\n",income);
}
}
return 0;
}
=>Need Help? Leave a Comment .
No comments:
Post a Comment