11547 Not understand the algorithm

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

Moderator: Board moderators

11547 Not understand the algorithm

Postby noor_aub » Sat Aug 29, 2009 6:04 am

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

Postby sms.islam » Tue Oct 27, 2009 4:16 pm

Read the problem description carefully.

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

Postby noor_aub » Wed Nov 11, 2009 7:35 pm

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

Postby Eather » Thu Jan 28, 2010 2:30 pm

I did this and I got AC :D

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

Postby mahi_seu.bd » Mon Dec 06, 2010 9:23 pm

#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;
} :P :P
mahi_seu.bd
New poster
 
Posts: 4
Joined: Mon Dec 06, 2010 8:25 pm
Location: Bangladesh


Return to Volume CXV

Who is online

Users browsing this forum: No registered users and 1 guest