## 11547 Not understand the algorithm

Moderator: Board moderators

### 11547 Not understand the algorithm

I have made this code according to this problem set but the output is not coming.
Some body help me.
Code: Select all
`#include<iostream>using namespace std;int main(){   _int64 re;   int cas,number;   cin>>cas;   while(cas--)   {      cin>>number;      re=0;      re=(_int64)((((((number*567)/9)+7492)*235)/47)-498);      printf("%I64d",re);   }   return 0;}`
noor_aub
New poster

Posts: 26
Joined: Sat Aug 22, 2009 12:16 pm

### Re: 11547 Not understand the algorithm

After getting re=12345678 (imagine)
you have to show 7

more:
98745>4
2587416>1

hope it helps.
sms.islam
New poster

Posts: 19
Joined: Sat Oct 10, 2009 10:28 am

### Re: 11547 Not understand the algorithm

Still I dont unser stand the algorithm. Please tell me in details.
noor_aub
New poster

Posts: 26
Joined: Sat Aug 22, 2009 12:16 pm

### Re: 11547 Not understand the algorithm

I did this and I got AC

Code: Select all
`#include<stdio.h>#include<math.h>#include<iostream>using namespace std;int main(){long long int n,t,i,j,res;   while((scanf("%ld",&i))==1&& i>0)   {      for(j=0;j<i;j++)      {      scanf("%ld",&n);      res = ((((((n*567)/9)+7492)*235)/47)-498);        if (res<0)          res = -res;        long long t = ((res%100)-(res%10))/10;        printf("%ld\n", t);      }   }   return 0;}[`
Eather
New poster

Posts: 28
Joined: Thu Jan 28, 2010 2:23 pm

### Re: 11547 Not understand the algorithm

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
int n,t,i,p,k;
scanf("%d",&t);
for(i=1;i<=t;i++){
k=0;p=0;
scanf("%d",&n);
p=((((((n*567)/9)+7492)*235)/47)-498);
if(p<0)
p*=-1;
k=(p/10)%10;
printf("%d\n",k);
}return 0;
}
mahi_seu.bd
New poster

Posts: 4
Joined: Mon Dec 06, 2010 8:25 pm