Code: Select all
int t = 100*(m-1);
Code: Select all
long long t = (long long)100*(m-1);
Moderator: Board moderators
Code: Select all
int t = 100*(m-1);
Code: Select all
long long t = (long long)100*(m-1);
Code: Select all
#include<stdio.h>
#include<string.h>
#include<math.h>
void main()
{
long i,j,p,a,sum;
double n,b,m,k;
while(scanf("%ld %lf",&a,&b)==2)
{
if(a==0&&b==0)break;
if(b==0||b==1||b==100){printf("Not found\n");continue;}
p=0;
for(i=a;;i++)
{
m=double(i);
n=i*b/100;k=m-((i-1)*b/100);
if((m-n)>=a-1)break;
if(k<m-n){p=1;break;}
//printf("%ld = %lf\n",i,m-n);
}
if(p==1){printf("Not found\n");continue;}
printf("%ld\n",i-1);
}
}
Code: Select all
#include<stdio.h>
#include<string.h>
#include<math.h>
void main()
{
long i,j,p,a,sm;
double n,b,m,k;
while(scanf("%ld %lf",&a,&b)==2)
{
if(a==0&&b==0)break;
if(b==0||b==1||b==100){printf("Not found\n");continue;}
p=1;
k=(a-1)*100/(100-b);
sm=ceil(k);
for(i=sm;i>=a;i--)
{
m=double(i);
n=i*b/100;
if((m-n)>=a-1){p=0;break;}
}
if(p==1){printf("Not found\n");continue;}
printf("%ld\n",i-1);
}
}
Code: Select all
#include<stdio.h>
int main()
{
long long int m,v,n;
double x;
while(1)
{
scanf("%lld %lf",&m,&x);
if(m==0 && x ==0)
break;
if (x == 100 || x == 0 || m == 1)
{
printf("Not found\n");
continue;
}
//v = (long int)(m-1)/(1.0-x/100.0);
v = (m-1)*100/(100-x);
//printf("%lld\n",v);
if(v >= m)
{
// if(v*100%(100-x)==0)
// v--;
n = v-v*(x/100);
if(n==(m-1))
v--;
n = v-v*(x/100);
if(n<m-1)
printf("%lld\n",v);
else
printf("Not found\n");
}
/*else if( v==m)
{
v--;
printf("%lld\n",v);
}*/
else
printf("Not found\n");
}
return 0;
}
Code: Select all
removed after acc....
Code: Select all
Code removed after ACC...
Hlw bro..just remove all the complex thinking about the problem..lazyboy wrote:Hi... my code passes for all the test cases given in this thread. but i got WA for many time. please give me some more test case for this problem. i post my code below.
Code: Select all
2345235 34
1243214 34
213123 45
21313 5
12432 65
456456 54
3452342 23
36213 21
324234 4
35645555 4
344 3
23325 100
234 0
12312 56
234234 4
0 0
Code: Select all
3553384
1883656
387494
22433
35517
992293
4483559
45837
337742
37130785
353
Not found
Not found
27979
243992